diff options
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 475862bc4c..573603b659 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -7288,8 +7288,8 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need PORT_INFO_1 *ports=NULL; int i=0; WERROR result = WERR_OK; - char **qlines; - int numlines; + char **qlines = NULL; + int numlines = 0; result = enumports_hook( &numlines, &qlines ); if (!W_ERROR_IS_OK(result)) { @@ -7354,12 +7354,14 @@ static WERROR enumports_level_2(RPC_BUFFER *buffer, uint32 offered, uint32 *need PORT_INFO_2 *ports=NULL; int i=0; WERROR result = WERR_OK; - char **qlines; - int numlines; + char **qlines = NULL; + int numlines = 0; - 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_2, numlines)) == NULL) { @@ -7371,10 +7373,10 @@ static WERROR enumports_level_2(RPC_BUFFER *buffer, uint32 offered, uint32 *need DEBUG(6,("Filling port number [%d] with port [%s]\n", i, qlines[i])); fill_port_2(&(ports[i]), qlines[i]); } - - file_lines_free(qlines); } + file_lines_free(qlines); + *returned = numlines; /* check the required size. */ |