summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2006-05-17 12:43:35 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2006-05-17 12:43:35 +0000
commit74f83645bee64fbfd065d8770fc401d66d3772b9 (patch)
treec56463e518e3edbc00750f206496f13ec525d137 /usr.bin
parent85420ecbd457ade5ecba4b741a4d3619f2974764 (diff)
fix leak; coverity via Kylene Jo Hall
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/scp.c6
-rw-r--r--usr.bin/ssh/sftp.c5
-rw-r--r--usr.bin/ssh/ssh-agent.c4
-rw-r--r--usr.bin/ssh/ssh-keygen.c6
-rw-r--r--usr.bin/ssh/sshconnect.c3
5 files changed, 14 insertions, 10 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index dd4d45f7cd8..2345a98be18 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.141 2006/04/01 05:50:29 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.142 2006/05/17 12:43:34 markus Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -189,7 +189,8 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout)
* Reserve two descriptors so that the real pipes won't get
* descriptors 0 and 1 because that will screw up dup2 below.
*/
- pipe(reserved);
+ if (pipe(reserved) < 0)
+ fatal("pipe: %s", strerror(errno));
/* Create a socket pair for communicating with ssh. */
if (pipe(pin) < 0)
@@ -490,6 +491,7 @@ toremote(char *targ, int argc, char **argv)
source(1, argv + i);
}
}
+ xfree(arg);
}
void
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c
index 392a2de1fd4..ce024d74c24 100644
--- a/usr.bin/ssh/sftp.c
+++ b/usr.bin/ssh/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.81 2006/04/20 21:53:44 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.82 2006/05/17 12:43:34 markus Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@@ -539,6 +539,7 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
if (g.gl_matchc == 1 && dst) {
/* If directory specified, append filename */
+ xfree(tmp);
if (is_dir(dst)) {
if (infer_path(g.gl_pathv[0], &tmp)) {
err = 1;
@@ -563,8 +564,6 @@ process_get(struct sftp_conn *conn, char *src, char *dst, char *pwd, int pflag)
out:
xfree(abs_src);
- if (abs_dst)
- xfree(abs_dst);
globfree(&g);
return(err);
}
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index a774d7be041..37e9feb983b 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.137 2006/03/30 09:58:16 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.138 2006/05/17 12:43:34 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -307,8 +307,8 @@ process_sign_request2(SocketEntry *e)
Identity *id = lookup_identity(key, 2);
if (id != NULL && (!id->confirm || confirm_key(id) == 0))
ok = key_sign(id->key, &signature, &slen, data, dlen);
+ key_free(key);
}
- key_free(key);
buffer_init(&msg);
if (ok == 0) {
buffer_put_char(&msg, SSH2_AGENT_SIGN_RESPONSE);
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index 50bfb07d47a..fa0a67c47c3 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.143 2006/03/30 11:05:17 dtucker Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.144 2006/05/17 12:43:34 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -514,8 +514,10 @@ do_fingerprint(struct passwd *pw)
xfree(fp);
exit(0);
}
- if (comment)
+ if (comment) {
xfree(comment);
+ comment = NULL;
+ }
f = fopen(identity_file, "r");
if (f != NULL) {
diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c
index a0e6725f0bc..2a7d5417015 100644
--- a/usr.bin/ssh/sshconnect.c
+++ b/usr.bin/ssh/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.181 2006/04/20 09:47:59 markus Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.182 2006/05/17 12:43:34 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -918,6 +918,7 @@ ssh_login(Sensitive *sensitive, const char *orighost,
ssh_kex(host, hostaddr);
ssh_userauth1(local_user, server_user, host, sensitive);
}
+ xfree(local_user);
}
void