summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clisecdesc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index d53b3073b2..59d8bdcc71 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -33,7 +33,7 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
char param[8];
char *rparam=NULL, *rdata=NULL;
int rparam_count=0, rdata_count=0;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *mem_ctx = NULL;
prs_struct pd;
SEC_DESC *psd = NULL;
@@ -74,11 +74,13 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
cleanup:
- talloc_destroy(mem_ctx);
+ if (mem_ctx) {
+ talloc_destroy(mem_ctx);
+ prs_mem_free(&pd);
+ }
safe_free(rparam);
safe_free(rdata);
- prs_mem_free(&pd);
return psd;
}
@@ -93,7 +95,7 @@ BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd)
char param[8];
char *rparam=NULL, *rdata=NULL;
int rparam_count=0, rdata_count=0;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *mem_ctx=NULL;
prs_struct pd;
BOOL ret = False;
@@ -138,9 +140,10 @@ BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd)
safe_free(rparam);
safe_free(rdata);
- talloc_destroy(mem_ctx);
-
- prs_mem_free(&pd);
+ if (mem_ctx) {
+ talloc_destroy(mem_ctx);
+ prs_mem_free(&pd);
+ }
return ret;
}