s3-net: make sure we dont crash when publishing a single printer.
authorGünther Deschner <gd@samba.org>
Fri, 1 Oct 2010 04:08:12 +0000 (06:08 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:57:59 +0000 (12:57 +0200)
Guenther
(cherry picked from commit 21576e3f8c32878910460bf9575c200ad93d682a)

Part of a fix for bug #7993 ("net rpc printer MIGRATE" command fails).
(cherry picked from commit 9c75728c62cccb8da606ece2d9df08b592e7c7c0)

source3/utils/net_rpc_printer.c

index dfc150fa3b0891e1f807cd4f0823ef374f4cab29..8b6d73eb525f26f2aea3d37972b2d811b63f615b 100644 (file)
@@ -1091,6 +1091,11 @@ static bool get_printer_info(struct rpc_pipe_client *pipe_hnd,
                                         &hnd))
                return false;
 
+       *info_p = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
+       if (*info_p == NULL) {
+               return false;
+       }
+
        if (!net_spoolss_getprinter(pipe_hnd, mem_ctx, &hnd, level, *info_p)) {
                rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
                return false;