1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Fix CID 498. Ensure we don't prs_mem_free an uninitialized

prs_struct.
Jeremy.
(This used to be commit 7b9d9fba23)
This commit is contained in:
Jeremy Allison 2008-01-11 23:24:13 -08:00
parent 9f75099657
commit 23aab9dab7

View File

@ -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;