summaryrefslogtreecommitdiffstats
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/cliconnect.c7
-rw-r--r--source3/libsmb/clisecdesc.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 29a9533bd24..659e1242922 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -989,7 +989,12 @@ BOOL cli_tdis(struct cli_state *cli)
if (!cli_receive_smb(cli))
return False;
- return !cli_is_error(cli);
+ if (cli_is_error(cli)) {
+ return False;
+ }
+
+ cli->cnum = -1;
+ return True;
}
/****************************************************************************
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index b79ea9d14ba..24757434794 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -30,6 +30,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
char *rparam=NULL, *rdata=NULL;
unsigned int rparam_count=0, rdata_count=0;
prs_struct pd;
+ BOOL pd_initialized = False;
SEC_DESC *psd = NULL;
SIVAL(param, 0, fnum);
@@ -56,7 +57,10 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
if (cli_is_error(cli))
goto cleanup;
- prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL);
+ if (!prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL)) {
+ goto cleanup;
+ }
+ pd_initialized = True;
prs_copy_data_in(&pd, rdata, rdata_count);
prs_set_offset(&pd,0);
@@ -70,7 +74,8 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum,
SAFE_FREE(rparam);
SAFE_FREE(rdata);
- prs_mem_free(&pd);
+ if (pd_initialized)
+ prs_mem_free(&pd);
return psd;
}