r14301: Fix coverity #224. In a loop we were forgetting to free
authorJeremy Allison <jra@samba.org>
Mon, 13 Mar 2006 06:50:33 +0000 (06:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:24 +0000 (11:15 -0500)
resources on error exit path.
Jeremy.
(This used to be commit f1a5e5aefeeb78512c41cc8fc075b240696a3eb7)

source3/rpc_server/srv_spoolss_nt.c

index 57509fcd87fb9608fcae8da30e7b87a329a01b30..31a278f7f378747a702652e3f619c7570aecc3f9 100644 (file)
@@ -6799,8 +6799,10 @@ static WERROR enumprinterdrivers_level2(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_2);
                        return WERR_NOMEM;
+               }
 
                if(ndrivers != 0) {
                        if((driver_info_2=SMB_REALLOC_ARRAY(driver_info_2, DRIVER_INFO_2, *returned+ndrivers )) == NULL) {