diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-06-16 15:08:21 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2004-06-16 15:08:21 +0000 |
commit | aef60d12d5c4e8aeafae3b35c3d112aad9a1a129 (patch) | |
tree | 7ad60696998e13605a86487b87a022ff42f71a24 /sbin/isakmpd/util.c | |
parent | 552fb71c335599f8b2c878851ce0b5f182129a15 (diff) |
Fix wrong pointer dereference and plug memleak. Found and patch by
Patrick Latifi. Thanks!
ok ho@
Diffstat (limited to 'sbin/isakmpd/util.c')
-rw-r--r-- | sbin/isakmpd/util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/isakmpd/util.c b/sbin/isakmpd/util.c index 55d4ddb1ce0..ae89c0be534 100644 --- a/sbin/isakmpd/util.c +++ b/sbin/isakmpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.41 2004/06/14 09:55:42 ho Exp $ */ +/* $OpenBSD: util.c,v 1.42 2004/06/16 15:08:20 hshoexer Exp $ */ /* $EOM: util.c,v 1.23 2000/11/23 12:22:08 niklas Exp $ */ /* @@ -256,8 +256,10 @@ text2sockaddr(char *address, char *port, struct sockaddr **sa) return -1; *sa = malloc(sysdep_sa_len(ai->ai_addr)); - if (!sa) + if (!*sa) { + freeaddrinfo(ai); return -1; + } memcpy(*sa, ai->ai_addr, sysdep_sa_len(ai->ai_addr)); freeaddrinfo(ai); |