summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2009-07-28 20:54:57 +0000
committerclaudio <claudio@openbsd.org>2009-07-28 20:54:57 +0000
commitee8ccc5d66f199dfdfac04948623a1821f43e9d1 (patch)
treeb79def6c606b21f8db8cd6f33d9c969802c873d9
parentslightly change how makemap parses its lines so that we consider # (diff)
downloadwireguard-openbsd-ee8ccc5d66f199dfdfac04948623a1821f43e9d1.tar.xz
wireguard-openbsd-ee8ccc5d66f199dfdfac04948623a1821f43e9d1.zip
Plug a memory leak when calling rtable_add(0) multiple times. Fixing this
even though adding an already existing routing table is not allowed. Leak found by blambert@, fix by myself. OK blambert@
-rw-r--r--sys/net/route.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index d2acd43bd47..d3c3696ddbb 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.109 2009/06/05 00:05:22 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.110 2009/07/28 20:54:57 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -228,7 +228,7 @@ rtable_add(u_int id) /* must be called at splsoftnet */
if ((p = malloc(newlen, M_RTABLE, M_NOWAIT|M_ZERO)) == NULL)
return (-1);
- if (id > 0) {
+ if (rt_tables) {
bcopy(rt_tables, p, sizeof(void *) * (rtbl_id_max+1));
free(rt_tables, M_RTABLE);
}