summaryrefslogtreecommitdiff
path: root/source/rpc_client/cli_spoolss.c
diff options
context:
space:
mode:
authortodd stecher <todd.stecher@gmail.com>2009-01-22 10:17:37 -0800
committerKarolin Seeger <kseeger@samba.org>2009-01-23 09:07:38 +0100
commit6b93dd04ee4dff93be3d66d7ab223e8b81e77d93 (patch)
treef50ca2b7161905538019f3afca714b7c3ecb805f /source/rpc_client/cli_spoolss.c
parent5739cc5eb4d222b435a3cc32c1733288bf3d5635 (diff)
downloadsamba-6b93dd04ee4dff93be3d66d7ab223e8b81e77d93.tar.gz
Memory leaks and other fixes found by Coverity
(cherry picked from commit ba576efa8f884f3dd37bb5035fbb47ae0305c0b0)
Diffstat (limited to 'source/rpc_client/cli_spoolss.c')
-rw-r--r--source/rpc_client/cli_spoolss.c66
1 files changed, 44 insertions, 22 deletions
diff --git a/source/rpc_client/cli_spoolss.c b/source/rpc_client/cli_spoolss.c
index 69cee6c8e84..30a707f943d 100644
--- a/source/rpc_client/cli_spoolss.c
+++ b/source/rpc_client/cli_spoolss.c
@@ -521,7 +521,8 @@ WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumprinters( &in, flags, name, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERS,
@@ -537,7 +538,8 @@ WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumprinters( &in, flags, name, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERS,
@@ -601,7 +603,8 @@ WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
strupper_m(server);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumports( &in, server, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPORTS,
@@ -617,7 +620,8 @@ WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumports( &in, server, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPORTS,
@@ -670,7 +674,8 @@ WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
/* Initialise input parameters */
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinter( mem_ctx, &in, pol, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETPRINTER,
@@ -686,7 +691,8 @@ WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinter( mem_ctx, &in, pol, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETPRINTER,
@@ -781,7 +787,8 @@ WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
strupper_m(server);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinterdriver2( &in, pol, env, level,
version, 2, &buffer, offered);
@@ -798,7 +805,8 @@ WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinterdriver2( &in, pol, env, level,
version, 2, &buffer, offered);
@@ -859,7 +867,8 @@ WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
strupper_m(server);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumprinterdrivers( &in, server, env, level,
&buffer, offered);
@@ -876,7 +885,8 @@ WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumprinterdrivers( &in, server, env, level,
&buffer, offered);
@@ -942,7 +952,8 @@ WERROR rpccli_spoolss_getprinterdriverdir (struct rpc_pipe_client *cli,
strupper_m(server);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinterdriverdir( &in, server, env, level,
&buffer, offered );
@@ -959,7 +970,8 @@ WERROR rpccli_spoolss_getprinterdriverdir (struct rpc_pipe_client *cli,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprinterdriverdir( &in, server, env, level,
&buffer, offered );
@@ -1125,7 +1137,8 @@ WERROR rpccli_spoolss_getprintprocessordirectory(struct rpc_pipe_client *cli,
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprintprocessordirectory( &in, name,
environment, level, &buffer, offered );
@@ -1142,7 +1155,8 @@ WERROR rpccli_spoolss_getprintprocessordirectory(struct rpc_pipe_client *cli,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getprintprocessordirectory( &in, name,
environment, level, &buffer, offered );
@@ -1230,7 +1244,8 @@ WERROR rpccli_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getform( &in, handle, formname, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETFORM,
@@ -1246,7 +1261,8 @@ WERROR rpccli_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getform( &in, handle, formname, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETFORM,
@@ -1309,7 +1325,8 @@ WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumforms( &in, handle, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMFORMS,
@@ -1325,7 +1342,8 @@ WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumforms( &in, handle, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMFORMS,
@@ -1365,7 +1383,8 @@ WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumjobs( &in, hnd, firstjob, num_jobs, level,
&buffer, offered );
@@ -1382,7 +1401,8 @@ WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_enumjobs( &in, hnd, firstjob, num_jobs, level,
&buffer, offered );
@@ -1461,7 +1481,8 @@ WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(out);
offered = 0;
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getjob( &in, hnd, jobid, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETJOB,
@@ -1477,7 +1498,8 @@ WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(in);
ZERO_STRUCT(out);
- rpcbuf_init(&buffer, offered, mem_ctx);
+ if (!rpcbuf_init(&buffer, offered, mem_ctx))
+ return WERR_NOMEM;
make_spoolss_q_getjob( &in, hnd, jobid, level, &buffer, offered );
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_GETJOB,