1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Cleaned up error handling in cli_initialise() to fix a memleak found by

Claudia Moroder <claudiamoroder@st-ulrich.suedtirol.net>
(This used to be commit b5373f4b59cfe1cffe915e5d4eb29ed83fe99ba6)
This commit is contained in:
Tim Potter 2001-08-06 02:18:40 +00:00
parent 54fc7e1aba
commit 9f08cea054

View File

@ -180,24 +180,28 @@ struct cli_state *cli_initialise(struct cli_state *cli)
cli->oplock_handler = cli_oplock_ack;
if (!cli->outbuf || !cli->inbuf)
{
return NULL;
}
goto error;
if ((cli->mem_ctx = talloc_init()) == NULL) {
free(cli->outbuf);
free(cli->inbuf);
return NULL;
}
if ((cli->mem_ctx = talloc_init()) == NULL)
goto error;
memset(cli->outbuf, '\0', cli->bufsize);
memset(cli->inbuf, '\0', cli->bufsize);
memset(cli->outbuf, 0, cli->bufsize);
memset(cli->inbuf, 0, cli->bufsize);
cli->nt_pipe_fnum = 0;
cli->initialised = 1;
return cli;
/* Clean up after malloc() error */
error:
safe_free(cli->inbuf);
safe_free(cli->outbuf);
return NULL;
}
/****************************************************************************