BOOL (*oplock_handler)(struct cli_state *cli, int fnum, unsigned char level);
BOOL force_dos_errors;
+
+ /* was this structure allocated by cli_initialise? If so, then
+ free in cli_shutdown() */
+ BOOL allocated;
};
#endif /* _CLIENT_H */
cli->nt_pipe_fnum = 0;
cli->initialised = 1;
+ cli->allocated = alloced_cli;
return cli;
****************************************************************************/
void cli_shutdown(struct cli_state *cli)
{
+ BOOL allocated;
SAFE_FREE(cli->outbuf);
SAFE_FREE(cli->inbuf);
#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);
+ }
}