diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-04 04:15:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-04 04:15:34 +0000 |
commit | e8072b366f5ecdf3ab9a030a80664186605c4911 (patch) | |
tree | 469d6c888b96b1b64a2db1df0530113f66cf1399 | |
parent | 42fa94d17d8074f808122d9412cf257dac4d71aa (diff) |
patch memory leaks; grendel@zeitbombe.org
-rw-r--r-- | usr.bin/ssh/key.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/monitor_wrap.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/sftp-glob.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-dss.c | 6 | ||||
-rw-r--r-- | usr.bin/ssh/ssh-rsa.c | 4 |
5 files changed, 18 insertions, 6 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c index 718cd16c0cd..34b36b0ebfe 100644 --- a/usr.bin/ssh/key.c +++ b/usr.bin/ssh/key.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -RCSID("$OpenBSD: key.c,v 1.46 2002/06/30 21:59:45 deraadt Exp $"); +RCSID("$OpenBSD: key.c,v 1.47 2002/07/04 04:15:33 deraadt Exp $"); #include <openssl/evp.h> @@ -763,6 +763,8 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp) *lenp = len; if (blobp != NULL) *blobp = buf; + else + xfree(buf); return len; } diff --git a/usr.bin/ssh/monitor_wrap.c b/usr.bin/ssh/monitor_wrap.c index c5ca5621efb..ded5cb66965 100644 --- a/usr.bin/ssh/monitor_wrap.c +++ b/usr.bin/ssh/monitor_wrap.c @@ -25,7 +25,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: monitor_wrap.c,v 1.14 2002/06/30 21:59:45 deraadt Exp $"); +RCSID("$OpenBSD: monitor_wrap.c,v 1.15 2002/07/04 04:15:33 deraadt Exp $"); #include <openssl/bn.h> #include <openssl/dh.h> @@ -490,6 +490,8 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp) *lenp = len; if (blobp != NULL) *blobp = buf; + else + xfree(blobp); return len; } diff --git a/usr.bin/ssh/sftp-glob.c b/usr.bin/ssh/sftp-glob.c index 3d718470ce2..b9d4e28961f 100644 --- a/usr.bin/ssh/sftp-glob.c +++ b/usr.bin/ssh/sftp-glob.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sftp-glob.c,v 1.11 2002/06/30 21:59:45 deraadt Exp $"); +RCSID("$OpenBSD: sftp-glob.c,v 1.12 2002/07/04 04:15:33 deraadt Exp $"); #include <glob.h> @@ -53,8 +53,10 @@ fudge_opendir(const char *path) r = xmalloc(sizeof(*r)); - if (do_readdir(cur.conn, (char *)path, &r->dir)) + if (do_readdir(cur.conn, (char *)path, &r->dir)) { + xfree(r); return(NULL); + } r->offset = 0; diff --git a/usr.bin/ssh/ssh-dss.c b/usr.bin/ssh/ssh-dss.c index dbf8465bae5..0215f1c9a8b 100644 --- a/usr.bin/ssh/ssh-dss.c +++ b/usr.bin/ssh/ssh-dss.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-dss.c,v 1.15 2002/06/23 03:30:17 deraadt Exp $"); +RCSID("$OpenBSD: ssh-dss.c,v 1.16 2002/07/04 04:15:33 deraadt Exp $"); #include <openssl/bn.h> #include <openssl/evp.h> @@ -85,6 +85,8 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, *lenp = SIGBLOB_LEN; if (sigp != NULL) *sigp = ret; + else + xfree(ret); } else { /* ietf-drafts */ buffer_init(&b); @@ -98,6 +100,8 @@ ssh_dss_sign(Key *key, u_char **sigp, u_int *lenp, *lenp = len; if (sigp != NULL) *sigp = ret; + else + xfree(ret); } return 0; } diff --git a/usr.bin/ssh/ssh-rsa.c b/usr.bin/ssh/ssh-rsa.c index 782279bad23..c7f5ed0b3a8 100644 --- a/usr.bin/ssh/ssh-rsa.c +++ b/usr.bin/ssh/ssh-rsa.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-rsa.c,v 1.21 2002/06/23 03:30:17 deraadt Exp $"); +RCSID("$OpenBSD: ssh-rsa.c,v 1.22 2002/07/04 04:15:33 deraadt Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -100,6 +100,8 @@ ssh_rsa_sign(Key *key, u_char **sigp, u_int *lenp, *lenp = len; if (sigp != NULL) *sigp = ret; + else + xfree(ret); return 0; } |