summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-13 03:56:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:23 -0500
commite4600491cf847668172c37857e972364b87b0c7a (patch)
tree5809803f5c95c23c0a2c4c137c11a929f67573a7 /source3/rpc_server
parent75247c5ea22f1a3572acd06b473baf0e560c54a5 (diff)
downloadsamba-e4600491cf847668172c37857e972364b87b0c7a.tar.gz
samba-e4600491cf847668172c37857e972364b87b0c7a.tar.bz2
samba-e4600491cf847668172c37857e972364b87b0c7a.zip
r14284: Fix coverity bug #103. Make code clearer - probably
not a real issue but this code is easier to read. Jeremy. (This used to be commit 6621acc68f9a65540330d5c0d07db2488a3e8678)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index e86b36a5fe..475862bc4c 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7241,6 +7241,8 @@ WERROR enumports_hook( int *count, char ***lines )
int ret;
int fd;
+ *count = 0;
+ *lines = NULL;
/* if no hook then just fill in the default port */
@@ -7259,9 +7261,9 @@ WERROR enumports_hook( int *count, char ***lines )
ret = smbrun(command, &fd);
DEBUG(10,("Returned [%d]\n", ret));
if (ret != 0) {
- if (fd != -1)
+ if (fd != -1) {
close(fd);
-
+ }
return WERR_ACCESS_DENIED;
}
@@ -7289,8 +7291,11 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need
char **qlines;
int numlines;
- if ( !W_ERROR_IS_OK(result = enumports_hook( &numlines, &qlines )) )
+ result = enumports_hook( &numlines, &qlines );
+ if (!W_ERROR_IS_OK(result)) {
+ file_lines_free(qlines);
return result;
+ }
if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
@@ -7304,9 +7309,8 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need
DEBUG(6,("Filling port number [%d] with port [%s]\n", i, qlines[i]));
fill_port_1(&ports[i], qlines[i]);
}
-
- file_lines_free(qlines);
}
+ file_lines_free(qlines);
*returned = numlines;