summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorcem <cem@FreeBSD.org>2016-04-20 02:01:45 +0000
committercem <cem@FreeBSD.org>2016-04-20 02:01:45 +0000
commit1fdda1ad1e35b2718d62101a52d1886f3ac42739 (patch)
tree94d562e552175d7ec3df8a0abea802dd0ecdf9f6 /sys/net
parent9904129a9f1c0d27452c71d567519c51ca61e673 (diff)
downloadFreeBSD-src-1fdda1ad1e35b2718d62101a52d1886f3ac42739.zip
FreeBSD-src-1fdda1ad1e35b2718d62101a52d1886f3ac42739.tar.gz
radix rn_inithead: Fix minor leak in low memory conditions
R_Zalloc is essentially a malloc(M_NOWAIT) wrapper. It is possible that 'rnh' failed to allocate, but 'rmh' succeeds. In that case, we bail out of rn_inithead() but previously did not free 'rmh'. Introduced in r287073 (projects/routing) / MFP r294706. Reported by: Coverity CID: 1350258 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/radix.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index b17858e..62c2c3b 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1156,6 +1156,8 @@ rn_inithead(void **head, int off)
if (rnh == NULL || rmh == NULL) {
if (rnh != NULL)
R_Free(rnh);
+ if (rmh != NULL)
+ R_Free(rmh);
return (0);
}
OpenPOWER on IntegriCloud