s3-spoolss: Allocate printer entries on the pipe struct.
authorSimo Sorce <idra@samba.org>
Wed, 30 Jun 2010 16:19:41 +0000 (12:19 -0400)
committerAndreas Schneider <asn@samba.org>
Fri, 10 Sep 2010 13:49:03 +0000 (15:49 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
source3/rpc_server/srv_spoolss_nt.c

index c1ede19fcf369dc284b06c1170cbb5929cd3321b..181868d186fd1fc541f6f79ba89616cb111cc721 100644 (file)
@@ -646,12 +646,13 @@ static bool open_printer_hnd(struct pipes_struct *p, struct policy_handle *hnd,
 
        DEBUG(10,("open_printer_hnd: name [%s]\n", name));
 
-       new_printer = TALLOC_ZERO_P(NULL, Printer_entry);
+       new_printer = talloc_zero(p->mem_ctx, Printer_entry);
        if (new_printer == NULL) {
                return false;
        }
        talloc_set_destructor(new_printer, printer_entry_destructor);
 
+       /* This also steals the printer_handle on the policy_handle */
        if (!create_policy_hnd(p, hnd, new_printer)) {
                TALLOC_FREE(new_printer);
                return false;