diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clientgen.c | 6 |
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; } |