diff options
author | Gerald Carter <jerry@samba.org> | 2003-03-31 17:43:45 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-03-31 17:43:45 +0000 |
commit | 4660928c61dd4d61f24fb447e1c71c828a7710b3 (patch) | |
tree | 7aaabc6960720e9843e0423412b083368165f93c /source3 | |
parent | 6bb9603237e2a8b0fbae54e51b985d300a6afc59 (diff) | |
download | samba-4660928c61dd4d61f24fb447e1c71c828a7710b3.tar.gz samba-4660928c61dd4d61f24fb447e1c71c828a7710b3.tar.bz2 samba-4660928c61dd4d61f24fb447e1c71c828a7710b3.zip |
fix potential smbd crash when we fail to alloacte a policy handle for a printer open; CR 2102 (reviewed by jreilly)
(This used to be commit 26478158bc03fdf019589ce68062100a39149b52)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 0e81fa38d5..4dd4456b2c 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -519,18 +519,19 @@ static BOOL open_printer_hnd(pipes_struct *p, POLICY_HND *hnd, char *name, uint3 ZERO_STRUCTP(new_printer); - if ( !(new_printer->ctx = talloc_init("Printer Entry [0x%x]", (uint32)hnd)) ) { - DEBUG(0,("open_printer_hnd: talloc_init() failed!\n")); + if (!create_policy_hnd(p, hnd, free_printer_entry, new_printer)) { + SAFE_FREE(new_printer); return False; } - new_printer->notify.option=NULL; - /* Add to the internal list. */ DLIST_ADD(printers_list, new_printer); - if (!create_policy_hnd(p, hnd, free_printer_entry, new_printer)) { - SAFE_FREE(new_printer); + new_printer->notify.option=NULL; + + if ( !(new_printer->ctx = talloc_init("Printer Entry [0x%x]", (uint32)hnd)) ) { + DEBUG(0,("open_printer_hnd: talloc_init() failed!\n")); + close_printer_handle(p, hnd); return False; } |