r11235: fix segfault in addprinter due to mixing talloc() and malloc()'d memory
authorGerald Carter <jerry@samba.org>
Thu, 20 Oct 2005 20:26:11 +0000 (20:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:08 +0000 (11:05 -0500)
source/rpc_server/srv_spoolss_nt.c

index a8fc1bc2293a86e9542cf19c7c94b4b959a9fc18..026e7681e00130ef905133de22984e6b802d34ed 100644 (file)
@@ -7413,13 +7413,11 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
        int     snum;
        WERROR err = WERR_OK;
 
-       if ((printer = SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL)) == NULL) {
+       if ( !(printer = TALLOC_ZERO_P(NULL, NT_PRINTER_INFO_LEVEL)) ) {
                DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n"));
                return WERR_NOMEM;
        }
 
-       ZERO_STRUCTP(printer);
-
        /* convert from UNICODE to ASCII - this allocates the info_2 struct inside *printer.*/
        if (!convert_printer_info(info, printer, 2)) {
                free_a_printer(&printer, 2);