From 989ad44d32c2e77972a966d91f1813b0b929f83b Mon Sep 17 00:00:00 2001 From: todd stecher Date: Mon, 19 Jan 2009 15:09:51 -0800 Subject: Memory leaks and other fixes found by Coverity --- source3/rpc_server/srv_pipe.c | 4 +++- source3/rpc_server/srv_spoolss_nt.c | 3 ++- source3/rpc_server/srv_svcctl_nt.c | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 4f78d69bcc..343342a06c 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -706,7 +706,7 @@ static int rpc_lookup_size; bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p) { RPC_HDR_AUTH auth_info; - uint32 pad; + uint32 pad = 0; DATA_BLOB blob; ZERO_STRUCT(blob); @@ -1839,6 +1839,8 @@ bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p) return False; } + ZERO_STRUCT(hdr_rb); + DEBUG(5,("api_pipe_alter_context: decode request. %d\n", __LINE__)); /* decode the alter context request */ diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 123cbf9335..ba2fe774b8 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -9927,7 +9927,8 @@ WERROR _spoolss_xcvdataport(pipes_struct *p, SPOOL_Q_XCVDATAPORT *q_u, SPOOL_R_X /* Allocate the outgoing buffer */ - rpcbuf_init( &r_u->outdata, q_u->offered, p->mem_ctx ); + if (!rpcbuf_init( &r_u->outdata, q_u->offered, p->mem_ctx )) + return WERR_NOMEM; switch ( Printer->printer_type ) { case SPLHND_PORTMON_TCP: diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c index 3b044944d9..33bf3d0098 100644 --- a/source3/rpc_server/srv_svcctl_nt.c +++ b/source3/rpc_server/srv_svcctl_nt.c @@ -580,7 +580,6 @@ WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, /* we have to set the outgoing buffer size to the same as the incoming buffer size (even in the case of failure) */ - *r->out.bytes_needed = r->in.buf_size; switch ( r->in.info_level ) { @@ -736,7 +735,6 @@ WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, /* we have to set the outgoing buffer size to the same as the incoming buffer size (even in the case of failure */ - *r->out.bytes_needed = r->in.buf_size; switch ( r->in.info_level ) { -- cgit