summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-08-06 23:29:25 +0000
committerTim Potter <tpot@samba.org>2001-08-06 23:29:25 +0000
commita6234ad6f297611bcd00f67d388de532d1a6874f (patch)
tree6e56bb7854db2b79844766f081373c73ba1496ac
parentb026e6edf290ec4cd77c2bb9a378630ddf7bc450 (diff)
downloadsamba-a6234ad6f297611bcd00f67d388de532d1a6874f.tar.gz
samba-a6234ad6f297611bcd00f67d388de532d1a6874f.tar.bz2
samba-a6234ad6f297611bcd00f67d388de532d1a6874f.zip
Fixed another possible memleak in cli_initialise()
(This used to be commit 4c9f010a1eef81addfea0315bef81570bc604f8a)
-rw-r--r--source3/libsmb/clientgen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 79fa224e8f..ba852dea52 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -152,11 +152,14 @@ initialise a client structure
****************************************************************************/
struct cli_state *cli_initialise(struct cli_state *cli)
{
+ BOOL alloced_cli = False;
+
if (!cli) {
cli = (struct cli_state *)malloc(sizeof(*cli));
if (!cli)
return NULL;
ZERO_STRUCTP(cli);
+ alloced_cli = True;
}
if (cli->initialised) {
@@ -201,6 +204,9 @@ struct cli_state *cli_initialise(struct cli_state *cli)
safe_free(cli->inbuf);
safe_free(cli->outbuf);
+ if (alloced_cli)
+ safe_free(cli);
+
return NULL;
}