spools: avoid leaking memory into the callers mem_ctx
[kseeger/samba-autobuild-v4-13-test/.git] / 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() */