s3-spoolss: Use tmp_ctx in winreg_printer_addform1_internal.
authorAndreas Schneider <asn@samba.org>
Mon, 25 Jul 2011 19:38:12 +0000 (21:38 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 27 Jul 2011 06:50:00 +0000 (08:50 +0200)
source3/rpc_server/spoolss/srv_spoolss_util.c

index a5023329033ce7b87426e18a31a562ddccf29979..df419ec0e5b07921fcc6d941c5089e77e1999b66 100644 (file)
@@ -642,12 +642,25 @@ WERROR winreg_printer_addform1_internal(TALLOC_CTX *mem_ctx,
 {
        WERROR result;
        struct dcerpc_binding_handle *b;
+       TALLOC_CTX *tmp_ctx;
 
-       result = winreg_printer_binding_handle(mem_ctx, session_info, msg_ctx, &b);
-       W_ERROR_NOT_OK_RETURN(result);
+       tmp_ctx = talloc_stackframe();
+       if (tmp_ctx == NULL) {
+               return WERR_NOMEM;
+       }
 
-       return winreg_printer_addform1(mem_ctx, b,
-                                      form);
+       result = winreg_printer_binding_handle(tmp_ctx, session_info, msg_ctx, &b);
+       if (!W_ERROR_IS_OK(result)) {
+               talloc_free(tmp_ctx);
+               return result;
+       }
+
+       result = winreg_printer_addform1(mem_ctx,
+                                        b,
+                                        form);
+
+       talloc_free(tmp_ctx);
+       return result;
 }
 
 WERROR winreg_printer_setform1_internal(TALLOC_CTX *mem_ctx,