summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-07-28 20:54:58 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-07-28 20:54:58 +0000
commit1956d5dae5defff52b013b3007574f13b4e9882d (patch)
treebe41911256f1a2358dc87894e125eb410c6cde1a /sys
parent72295dbedd1af93b332f58095676e3fa24e412ab (diff)
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@
Diffstat (limited to 'sys')
-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);
}