diff options
author | Jeremy Allison <jra@samba.org> | 2006-03-13 06:48:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:24 -0500 |
commit | 860015db1fe89944e37163234505d26b7cfe5386 (patch) | |
tree | 58dd1eb9081229e1d58bb3c35f81c322dd80c952 | |
parent | 659eb9b71fe7427a1362e7b922a78dbd395258c2 (diff) | |
download | samba-860015db1fe89944e37163234505d26b7cfe5386.tar.gz samba-860015db1fe89944e37163234505d26b7cfe5386.tar.bz2 samba-860015db1fe89944e37163234505d26b7cfe5386.zip |
r14299: Fix coverity #225. In a loop we were forgetting to free
resources on error exit path.
Jeremy.
(This used to be commit 1c0b4ed0acdb7fccb148d714796752fefc6dd78c)
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index dd706b68ed..57509fcd87 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -6871,8 +6871,8 @@ static WERROR enumprinterdrivers_level3(fstring servername, fstring architecture int ndrivers; uint32 version; fstring *list = NULL; - NT_PRINTER_DRIVER_INFO_LEVEL driver; DRIVER_INFO_3 *driver_info_3=NULL; + NT_PRINTER_DRIVER_INFO_LEVEL driver; WERROR result = WERR_OK; *returned=0; @@ -6882,8 +6882,10 @@ static WERROR enumprinterdrivers_level3(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_3); return WERR_NOMEM; + } if(ndrivers != 0) { if((driver_info_3=SMB_REALLOC_ARRAY(driver_info_3, DRIVER_INFO_3, *returned+ndrivers )) == NULL) { @@ -6936,8 +6938,9 @@ static WERROR enumprinterdrivers_level3(fstring servername, fstring architecture } out: - for (i=0; i<*returned; i++) + for (i=0; i<*returned; i++) { SAFE_FREE(driver_info_3[i].dependentfiles); + } SAFE_FREE(driver_info_3); |