summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2008-02-06 11:37:54 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2008-02-06 11:37:54 +0000
commita22efea4d090fdc83b0b742bae99b46150b9c19f (patch)
treea2659a4793b4507c0d0b4cf7f88f7f4874dfef6d /sbin
parent83d098644cba1ac6427ea81419272f056c1f90dc (diff)
Fix possible memory leaks when sending phase 1 IDs.
From Igor Zinovik <zinovik@cs.karelia.ru> ok hshoexer@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/ike_phase_1.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sbin/isakmpd/ike_phase_1.c b/sbin/isakmpd/ike_phase_1.c
index d793d13ddbd..d6933c79290 100644
--- a/sbin/isakmpd/ike_phase_1.c
+++ b/sbin/isakmpd/ike_phase_1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_phase_1.c,v 1.70 2007/08/05 09:43:09 tom Exp $ */
+/* $OpenBSD: ike_phase_1.c,v 1.71 2008/02/06 11:37:53 moritz Exp $ */
/* $EOM: ike_phase_1.c,v 1.31 2000/12/11 23:47:56 niklas Exp $ */
/*
@@ -840,11 +840,13 @@ ike_phase_1_send_ID(struct message *msg)
if (!data) {
log_print("ike_phase_1_send_ID: section %s "
"has no \"Address\" tag", my_id);
+ free(buf);
return -1;
}
if (text2sockaddr(data, NULL, &src, af, 0)) {
log_error("ike_phase_1_send_ID: "
"text2sockaddr() failed");
+ free(buf);
return -1;
}
memcpy(buf + ISAKMP_ID_DATA_OFF,
@@ -859,11 +861,13 @@ ike_phase_1_send_ID(struct message *msg)
if (!data) {
log_print("ike_phase_1_send_ID: section %s "
"has no \"Network\" tag", my_id);
+ free(buf);
return -1;
}
if (text2sockaddr(data, NULL, &src, af, 0)) {
log_error("ike_phase_1_send_ID: "
"text2sockaddr() failed");
+ free(buf);
return -1;
}
memcpy(buf + ISAKMP_ID_DATA_OFF,
@@ -874,11 +878,13 @@ ike_phase_1_send_ID(struct message *msg)
if (!data) {
log_print("ike_phase_1_send_ID: section %s "
"has no \"Netmask\" tag", my_id);
+ free(buf);
return -1;
}
if (text2sockaddr(data, NULL, &src, af, 1)) {
log_error("ike_phase_1_send_ID: "
"text2sockaddr() failed");
+ free(buf);
return -1;
}
memcpy(buf + ISAKMP_ID_DATA_OFF +
@@ -894,6 +900,7 @@ ike_phase_1_send_ID(struct message *msg)
if (!data) {
log_print("ike_phase_1_send_ID: section %s "
"has no \"Name\" tag", my_id);
+ free(buf);
return -1;
}
memcpy(buf + ISAKMP_ID_DATA_OFF, data,