]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
spools: avoid leaking memory into the callers mem_ctx
authorRalph Boehme <slow@samba.org>
Mon, 22 Mar 2021 11:06:39 +0000 (12:06 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 31 Mar 2021 11:11:31 +0000 (11:11 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/rpc_server/spoolss/srv_spoolss_nt.c

index c60f91b558165420db02e81f037dd3bad7508c1a..1ccfd11ff7e94a42ea2253fbe0447f68cce1586c 100644 (file)
@@ -5731,7 +5731,8 @@ static WERROR construct_printer_driver_info_level(TALLOC_CTX *mem_ctx,
        }
 
        if (pinfo2->drivername == NULL || pinfo2->drivername[0] == '\0') {
-               return WERR_UNKNOWN_PRINTER_DRIVER;
+               result = WERR_UNKNOWN_PRINTER_DRIVER;
+               goto done;
        }
 
        DBG_INFO("Construct printer driver [%s] for [%s]\n",
@@ -7023,7 +7024,8 @@ static WERROR update_printer(struct pipes_struct *p,
                raddr = tsocket_address_inet_addr_string(p->remote_address,
                                                         p->mem_ctx);
                if (raddr == NULL) {
-                       return WERR_NOT_ENOUGH_MEMORY;
+                       result = WERR_NOT_ENOUGH_MEMORY;
+                       goto done;
                }
 
                /* add_printer_hook() will call reload_services() */