diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-11-27 03:29:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-11-27 03:29:20 +0000 |
commit | 701ecfc7a0a944844cadfd0b2c19f104ab7984b0 (patch) | |
tree | d7fa8d7a7630eec79b8fb2f5b8c49fba79e1136d /source3/libsmb | |
parent | 097d46653632855edd429fb8cd44d80f3e30c86c (diff) | |
download | samba-701ecfc7a0a944844cadfd0b2c19f104ab7984b0.tar.gz samba-701ecfc7a0a944844cadfd0b2c19f104ab7984b0.tar.bz2 samba-701ecfc7a0a944844cadfd0b2c19f104ab7984b0.zip |
prevent a memory leak of cli structures
(This used to be commit 911c57403bd116405876e73913ad73efd15f659b)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/clientgen.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 0e09388803..610af9cc23 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -217,6 +217,7 @@ struct cli_state *cli_initialise(struct cli_state *cli) cli->nt_pipe_fnum = 0; cli->initialised = 1; + cli->allocated = alloced_cli; return cli; @@ -238,6 +239,7 @@ shutdown a client structure ****************************************************************************/ void cli_shutdown(struct cli_state *cli) { + BOOL allocated; SAFE_FREE(cli->outbuf); SAFE_FREE(cli->inbuf); @@ -252,7 +254,11 @@ void cli_shutdown(struct cli_state *cli) #endif /* WITH_SSL */ if (cli->fd != -1) close(cli->fd); - memset(cli, 0, sizeof(*cli)); + allocated = cli->allocated; + ZERO_STRUCTP(cli); + if (allocated) { + free(cli); + } } |