diff options
author | Jeremy Allison <jra@samba.org> | 2008-01-11 23:24:13 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-01-11 23:24:13 -0800 |
commit | 23aab9dab781a160ababd475e8333c04570fd08d (patch) | |
tree | b8b12d919106117c07a74cbc09be94f9b4119aef /source3 | |
parent | 9f750996571c75b0be53fdf13705b95bf6126102 (diff) | |
download | samba-23aab9dab781a160ababd475e8333c04570fd08d.tar.gz samba-23aab9dab781a160ababd475e8333c04570fd08d.tar.bz2 samba-23aab9dab781a160ababd475e8333c04570fd08d.zip |
Fix CID 498. Ensure we don't prs_mem_free an uninitialized
prs_struct.
Jeremy.
(This used to be commit 7b9d9fba230b9e61079869a6a2751cda37fb8a9e)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/printing/nt_printing.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 1a4a26ee6f..bba55c0e4a 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -5326,6 +5326,7 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) SEC_DESC_BUF *new_secdesc_ctr = NULL; SEC_DESC_BUF *old_secdesc_ctr = NULL; prs_struct ps; + bool prs_init_done = false; TALLOC_CTX *mem_ctx = NULL; TDB_DATA kbuf; WERROR status; @@ -5394,6 +5395,8 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) (uint32)ndr_size_security_descriptor(new_secdesc_ctr->sd, 0) + sizeof(SEC_DESC_BUF), mem_ctx, MARSHALL); + prs_init_done = true; + if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr, &ps, 1)) { status = WERR_BADFUNC; @@ -5413,7 +5416,9 @@ WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr) out: - prs_mem_free(&ps); + if (prs_init_done) { + prs_mem_free(&ps); + } if (mem_ctx) talloc_destroy(mem_ctx); return status; |