r14250: Fix coverity bug #107. Resource leak on error path.
authorJeremy Allison <jra@samba.org>
Sun, 12 Mar 2006 19:16:45 +0000 (19:16 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:20 +0000 (11:15 -0500)
Jeremy.

source/rpc_server/srv_spoolss_nt.c

index 2424c46691eb836586145c9fce7583f22d0542fd..951757d4c8a987f168ce6f6a54c24baf7de59b35 100644 (file)
@@ -4862,8 +4862,10 @@ static WERROR getprinter_level_5(Printer_entry *print_hnd, int snum, RPC_BUFFER
        if((printer=SMB_MALLOC_P(PRINTER_INFO_5))==NULL)
                return WERR_NOMEM;
 
-       if (!construct_printer_info_5(print_hnd, printer, snum))
+       if (!construct_printer_info_5(print_hnd, printer, snum)) {
+               free_printer_info_5(printer);
                return WERR_NOMEM;
+       }
        
        /* check the required size. */  
        *needed += spoolss_size_printer_info_5(printer);