summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-22 03:38:48 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-22 03:38:48 +0000
commit1239b92c73a803c5cb517925523a2936df51a232 (patch)
tree43f890defa88d48f70701dcbfbd0f51deb66ec46 /source3/libsmb
parent21b1ab0a76d051dda3400e99324573f6bffe4d03 (diff)
downloadsamba-1239b92c73a803c5cb517925523a2936df51a232.tar.gz
samba-1239b92c73a803c5cb517925523a2936df51a232.tar.bz2
samba-1239b92c73a803c5cb517925523a2936df51a232.zip
make sure we don't free non-allocated data
(This used to be commit 4a620f7037378dc042b6388ede6356c6db5d58fb)
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;
}