summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_use.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source3/rpc_client/cli_use.c b/source3/rpc_client/cli_use.c
index 99cdb129f7..69e46c081b 100644
--- a/source3/rpc_client/cli_use.c
+++ b/source3/rpc_client/cli_use.c
@@ -43,9 +43,15 @@ terminate client connection
****************************************************************************/
static void cli_use_free(struct cli_use *cli)
{
- cli_ulogoff(cli->cli);
- cli_shutdown(cli->cli);
- free(cli->cli);
+ if (cli->cli != NULL)
+ {
+ if (cli->cli->initialised)
+ {
+ cli_ulogoff(cli->cli);
+ cli_shutdown(cli->cli);
+ }
+ free(cli->cli);
+ }
free(cli);
}