summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2012-03-24 00:40:26 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2012-03-24 00:40:26 +0000
commit897ad8fd7ac1a7c853106af4a28e256371b513cb (patch)
tree473558f4afb6df5b15634bc37b75f47f7bd23a14 /sbin
parent3a829b1c12609aae928c035b8f17ae238f6e809b (diff)
fix some leaks
ok mikeb@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/iked/ikev2_pld.c4
-rw-r--r--sbin/iked/parse.y8
-rw-r--r--sbin/iked/pfkey.c4
-rw-r--r--sbin/iked/util.c4
4 files changed, 13 insertions, 7 deletions
diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c
index 98ca90b9d07..3aa09338304 100644
--- a/sbin/iked/ikev2_pld.c
+++ b/sbin/iked/ikev2_pld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2_pld.c,v 1.21 2011/01/26 16:59:24 mikeb Exp $ */
+/* $OpenBSD: ikev2_pld.c,v 1.22 2012/03/24 00:40:25 jsg Exp $ */
/* $vantronix: ikev2.c,v 1.101 2010/06/03 07:57:33 reyk Exp $ */
/*
@@ -860,7 +860,7 @@ ikev2_pld_delete(struct iked *env, struct ikev2_payload *pld,
/* Parsed outgoing message? */
if (!ikev2_msg_frompeer(msg))
- return (0);
+ goto done;
if (ikev2_msg_frompeer(msg) && (sa->sa_stateflags & IKED_REQ_DELETE)) {
/* Finish rekeying */
diff --git a/sbin/iked/parse.y b/sbin/iked/parse.y
index deca4b3908f..7f89354454b 100644
--- a/sbin/iked/parse.y
+++ b/sbin/iked/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.22 2011/05/27 12:01:02 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.23 2012/03/24 00:40:25 jsg Exp $ */
/* $vantronix: parse.y,v 1.22 2010/06/03 11:08:34 reyk Exp $ */
/*
@@ -1551,7 +1551,7 @@ int
parsekeyfile(char *filename, struct iked_auth *auth)
{
struct stat sb;
- int fd;
+ int fd, ret;
unsigned char *hex;
if ((fd = open(filename, O_RDONLY)) < 0)
@@ -1566,7 +1566,9 @@ parsekeyfile(char *filename, struct iked_auth *auth)
if (read(fd, hex, sb.st_size) < sb.st_size)
err(1, "parsekeyfile: read");
close(fd);
- return (parsekey(hex, sb.st_size, auth));
+ ret = parsekey(hex, sb.st_size, auth);
+ free(hex);
+ return (ret);
}
int
diff --git a/sbin/iked/pfkey.c b/sbin/iked/pfkey.c
index 45a9eba40e4..11b25111cc4 100644
--- a/sbin/iked/pfkey.c
+++ b/sbin/iked/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.16 2011/05/27 12:01:02 reyk Exp $ */
+/* $OpenBSD: pfkey.c,v 1.17 2012/03/24 00:40:25 jsg Exp $ */
/* $vantronix: pfkey.c,v 1.11 2010/06/03 07:57:33 reyk Exp $ */
/*
@@ -1454,6 +1454,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm)
break;
default:
log_debug("%s: bad address family", __func__);
+ free(reply);
return;
}
@@ -1478,6 +1479,7 @@ pfkey_process(struct iked *env, struct pfkey_message *pm)
break;
default:
log_debug("%s: bad address family", __func__);
+ free(reply);
return;
}
diff --git a/sbin/iked/util.c b/sbin/iked/util.c
index a3cda7bff97..a5fdd287120 100644
--- a/sbin/iked/util.c
+++ b/sbin/iked/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.13 2011/05/27 12:01:02 reyk Exp $ */
+/* $OpenBSD: util.c,v 1.14 2012/03/24 00:40:25 jsg Exp $ */
/* $vantronix: util.c,v 1.39 2010/06/02 12:22:58 reyk Exp $ */
/*
@@ -664,6 +664,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl)
if ((strlcat(tmp, p, len) >= len) ||
(strlcat(tmp, repl, len) >= len)) {
log_debug("expand_string: string too long");
+ free(tmp);
return (-1);
}
q += strlen(srch);
@@ -671,6 +672,7 @@ expand_string(char *label, size_t len, const char *srch, const char *repl)
}
if (strlcat(tmp, p, len) >= len) {
log_debug("expand_string: string too long");
+ free(tmp);
return (-1);
}
strlcpy(label, tmp, len); /* always fits */