r14303: Fix coverity #223. In a loop we were forgetting to free
authorJeremy Allison <jra@samba.org>
Mon, 13 Mar 2006 06:52:03 +0000 (06:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:24 +0000 (11:15 -0500)
resources on error exit path.
Jeremy.

source/rpc_server/srv_spoolss_nt.c

index 31a278f7f378747a702652e3f619c7570aecc3f9..70432c34ca3017c1236c99b17acea43ec5243cb3 100644 (file)
@@ -6717,8 +6717,10 @@ static WERROR enumprinterdrivers_level1(fstring servername, fstring architecture
                ndrivers=get_ntdrivers(&list, architecture, version);
                DEBUGADD(4,("we have:[%d] drivers in environment [%s] and version [%d]\n", ndrivers, architecture, version));
 
-               if(ndrivers == -1)
+               if(ndrivers == -1) {
+                       SAFE_FREE(driver_info_1);
                        return WERR_NOMEM;
+               }
 
                if(ndrivers != 0) {
                        if((driver_info_1=SMB_REALLOC_ARRAY(driver_info_1, DRIVER_INFO_1, *returned+ndrivers )) == NULL) {