summaryrefslogtreecommitdiffstats
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
commit4a620f7037378dc042b6388ede6356c6db5d58fb (patch)
tree99088ec9ed98f67e4319c919f71c18536ffd4a9c
parent847de3b4adfb00a98032e478b2663d09e240380e (diff)
downloadsamba-4a620f7037378dc042b6388ede6356c6db5d58fb.tar.gz
samba-4a620f7037378dc042b6388ede6356c6db5d58fb.tar.xz
samba-4a620f7037378dc042b6388ede6356c6db5d58fb.zip
make sure we don't free non-allocated data
-rw-r--r--source/libsmb/clisecdesc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/libsmb/clisecdesc.c b/source/libsmb/clisecdesc.c
index d53b3073b29..59d8bdcc71d 100644
--- a/source/libsmb/clisecdesc.c
+++ b/source/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;
}