diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-05-27 17:06:12 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-05-28 10:04:46 +0200 |
commit | 315ae8ae9787935f012169b2c001a827078c92e0 (patch) | |
tree | 606225e2078087c7b328b0460d4e0e1433092e85 | |
parent | 2c325236be3d16c200ba4f85d8f0a33b3c5d8e73 (diff) | |
download | samba-315ae8ae9787935f012169b2c001a827078c92e0.tar.gz samba-315ae8ae9787935f012169b2c001a827078c92e0.tar.bz2 samba-315ae8ae9787935f012169b2c001a827078c92e0.zip |
s4:libcli/clideltree.c - fix "asprintf"s
-rw-r--r-- | source4/libcli/clideltree.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/libcli/clideltree.c b/source4/libcli/clideltree.c index d947ac3547..7bce95c2a1 100644 --- a/source4/libcli/clideltree.c +++ b/source4/libcli/clideltree.c @@ -41,7 +41,10 @@ static void delete_fn(struct clilist_file_info *finfo, const char *name, void *s n = strdup(name); n[strlen(n)-1] = 0; - asprintf(&s, "%s%s", n, finfo->name); + if (asprintf(&s, "%s%s", n, finfo->name) < 0) { + free(n); + return; + } if (finfo->attrib & FILE_ATTRIBUTE_READONLY) { if (NT_STATUS_IS_ERR(smbcli_setatr(dstate->tree, s, 0, 0))) { @@ -52,7 +55,11 @@ static void delete_fn(struct clilist_file_info *finfo, const char *name, void *s if (finfo->attrib & FILE_ATTRIBUTE_DIRECTORY) { char *s2; - asprintf(&s2, "%s\\*", s); + if (asprintf(&s2, "%s\\*", s) < 0) { + free(s); + free(n); + return; + } smbcli_unlink(dstate->tree, s2); smbcli_list(dstate->tree, s2, FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, @@ -109,7 +116,9 @@ int smbcli_deltree(struct smbcli_tree *tree, const char *dname) } } - asprintf(&mask, "%s\\*", dname); + if (asprintf(&mask, "%s\\*", dname) < 0) { + return -1; + } smbcli_unlink(dstate.tree, mask); smbcli_list(dstate.tree, mask, FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, |