summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-03-09 20:42:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:11:11 -0500
commit10373355df7b4d83581589ce496d52bcbe4fefd8 (patch)
treebe1c94f6f6d258f9ae5e79c72b767f7fe05866f7
parentaa3cab954e1d33bb8e5a5891e2b4f8024cfe5b70 (diff)
downloadsamba-10373355df7b4d83581589ce496d52bcbe4fefd8.tar.gz
samba-10373355df7b4d83581589ce496d52bcbe4fefd8.tar.bz2
samba-10373355df7b4d83581589ce496d52bcbe4fefd8.zip
r14098: Fix Coverity # 112
(This used to be commit 121a350b92dafec8f171a54f4b897c7f81757dd1)
-rw-r--r--source3/utils/net.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 99a289bcd4..1389885ba1 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -249,12 +249,21 @@ NTSTATUS connect_dst_pipe(struct cli_state **cli_dst, struct rpc_pipe_client **p
struct cli_state *cli_tmp = NULL;
struct rpc_pipe_client *pipe_hnd = NULL;
- if (opt_destination)
- server_name = SMB_STRDUP(opt_destination);
+ if (server_name == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ if (opt_destination) {
+ SAFE_FREE(server_name);
+ if ((server_name = SMB_STRDUP(opt_destination)) == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
/* make a connection to a named pipe */
nt_status = connect_to_ipc(&cli_tmp, NULL, server_name);
if (!NT_STATUS_IS_OK(nt_status)) {
+ SAFE_FREE(server_name);
return nt_status;
}
@@ -262,11 +271,13 @@ NTSTATUS connect_dst_pipe(struct cli_state **cli_dst, struct rpc_pipe_client **p
if (!pipe_hnd) {
DEBUG(0, ("couldn't not initialize pipe\n"));
cli_shutdown(cli_tmp);
+ SAFE_FREE(server_name);
return nt_status;
}
*cli_dst = cli_tmp;
*pp_pipe_hnd = pipe_hnd;
+ SAFE_FREE(server_name);
return nt_status;
}