r23758: Fix Coverity id 385
authorVolker Lendecke <vlendec@samba.org>
Mon, 9 Jul 2007 08:04:43 +0000 (08:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:53 +0000 (12:23 -0500)
source/rpc_server/srv_spoolss_nt.c

index 2047e13df36e37e448e06a13b867df1d6d889b07..464ca36f3c0e9d7dba8942de772014cbd53e92d3 100644 (file)
@@ -7490,8 +7490,13 @@ WERROR enumports_hook( int *count, char ***lines )
        /* if no hook then just fill in the default port */
        
        if ( !*cmd ) {
-               qlines = SMB_MALLOC_ARRAY( char*, 2 );
-               qlines[0] = SMB_STRDUP( SAMBA_PRINTER_PORT_NAME );
+               if (!(qlines = SMB_MALLOC_ARRAY( char*, 2 ))) {
+                       return WERR_NOMEM;
+               }
+               if (!(qlines[0] = SMB_STRDUP( SAMBA_PRINTER_PORT_NAME ))) {
+                       SAFE_FREE(qlines);
+                       return WERR_NOMEM;
+               }
                qlines[1] = NULL;
                numlines = 1;
        }