summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2020-03-10 10:07:47 +0000
committertobhe <tobhe@cvs.openbsd.org>2020-03-10 10:07:47 +0000
commit83a9eae8d0a66eafc7fa8564a1e03f857336da44 (patch)
tree5f13094d5eaadef656bf7509b2538126ea49b6ff /sbin/iked
parentd3f666b90289c076780947684276e163b3cab5ed (diff)
Fix memory leak of 'cr' if allocation of 'cr->data' fails.
ok markus@
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/ikev2_pld.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c
index fbe909d7faa..82b9dd36d5a 100644
--- a/sbin/iked/ikev2_pld.c
+++ b/sbin/iked/ikev2_pld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ikev2_pld.c,v 1.77 2020/02/21 15:17:34 tobhe Exp $ */
+/* $OpenBSD: ikev2_pld.c,v 1.78 2020/03/10 10:07:46 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -866,6 +866,7 @@ ikev2_pld_certreq(struct iked *env, struct ikev2_payload *pld,
}
if ((cr->cr_data = ibuf_new(buf, len)) == NULL) {
log_info("%s: failed to allocate buffer.", __func__);
+ free(cr);
return (-1);
}
cr->cr_type = cert.cert_type;