diff options
author | Richard Sharpe <sharpe@samba.org> | 2001-03-28 14:45:57 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@samba.org> | 2001-03-28 14:45:57 +0000 |
commit | 4fc385ca6830cb2ac6198501966088fbed27330e (patch) | |
tree | 9dc3d8ca6c81d142d9695a3a011db6805084d93e /source/libsmb | |
parent | cea13dff759dfb7efb5d2a248dd77905e16b1605 (diff) | |
download | samba-4fc385ca6830cb2ac6198501966088fbed27330e.tar.gz samba-4fc385ca6830cb2ac6198501966088fbed27330e.tar.xz samba-4fc385ca6830cb2ac6198501966088fbed27330e.zip |
More memory leaks fixed courtesy of Insure ...
Diffstat (limited to 'source/libsmb')
-rw-r--r-- | source/libsmb/libsmbclient.c | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index 826b5fdeb5c..0873661317e 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -1507,7 +1507,10 @@ int smbc_opendir(const char *fname) if (share[0] != (char)0 || path[0] != (char)0) { errno = EINVAL; - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1544,7 +1547,10 @@ int smbc_opendir(const char *fname) if (!srv) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1557,7 +1563,10 @@ int smbc_opendir(const char *fname) if (!cli_NetServerEnum(&srv->cli, lp_workgroup(), 0x80000000, list_fn, (void *)smbc_file_table[slot])) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; errno = cli_error(&srv->cli, &eclass, &ecode, NULL); return -1; @@ -1571,7 +1580,10 @@ int smbc_opendir(const char *fname) if (path[0] != (char)0) { /* Should not have empty share with path */ errno = EINVAL; - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1606,7 +1618,10 @@ int smbc_opendir(const char *fname) if (!srv) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; /* FIXME: Memory leaks ... */ return -1; @@ -1619,7 +1634,10 @@ int smbc_opendir(const char *fname) if (!cli_NetServerEnum(&srv->cli, server, 0x0000FFFE, list_fn, (void *)smbc_file_table[slot])) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; errno = cli_error(&srv->cli, &eclass, &ecode, NULL); return -1; @@ -1639,7 +1657,10 @@ int smbc_opendir(const char *fname) if (!srv) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1653,7 +1674,10 @@ int smbc_opendir(const char *fname) (void *)smbc_file_table[slot]) < 0) { errno = cli_error(&srv->cli, &eclass, &ecode, NULL); - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1663,7 +1687,10 @@ int smbc_opendir(const char *fname) else { errno = ENODEV; /* Neither the workgroup nor server exists */ - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1682,7 +1709,10 @@ int smbc_opendir(const char *fname) if (!srv) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; return -1; @@ -1697,7 +1727,10 @@ int smbc_opendir(const char *fname) if (cli_list(&srv->cli, path, aDIR | aSYSTEM | aHIDDEN, dir_list_fn, (void *)smbc_file_table[slot]) < 0) { - if (smbc_file_table[slot]) free(smbc_file_table[slot]); + if (smbc_file_table[slot]) { + if (smbc_file_table[slot]->fname) free(smbc_file_table[slot]->fname); + free(smbc_file_table[slot]); + } smbc_file_table[slot] = NULL; errno = smbc_errno(&srv->cli); return -1; |