diff options
author | Gerald Carter <jerry@samba.org> | 2003-03-31 17:39:21 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-03-31 17:39:21 +0000 |
commit | b5733dd6ef7c006b0ffc0e6a3c58c30a5d12a585 (patch) | |
tree | f227c16b01f57313d308d642ac3198fce3b1bf97 | |
parent | 9d3b00b4bf34438ae8cd8383de9156db70f8435c (diff) | |
download | samba-b5733dd6ef7c006b0ffc0e6a3c58c30a5d12a585.tar.gz samba-b5733dd6ef7c006b0ffc0e6a3c58c30a5d12a585.tar.bz2 samba-b5733dd6ef7c006b0ffc0e6a3c58c30a5d12a585.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 a179c2cefb15b1b8869a83fe5f14a85d1eb96114)
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 99711cbb13..9c9dd438b3 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -519,21 +519,22 @@ 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; } - + if (!set_printer_hnd_printertype(new_printer, name)) { close_printer_handle(p, hnd); return False; |