summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c8
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);
+ }
}