aboutsummaryrefslogtreecommitdiff
path: root/sys/net/radix.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2016-04-20 02:01:45 +0000
committerConrad Meyer <cem@FreeBSD.org>2016-04-20 02:01:45 +0000
commit856d8ddbb34d1816c5233b6f9155034a6a748722 (patch)
tree94d562e552175d7ec3df8a0abea802dd0ecdf9f6 /sys/net/radix.c
parent5412ec6e3f1a5ee0b1e851d298ae646c9fb02162 (diff)
downloadsrc-856d8ddbb34d1816c5233b6f9155034a6a748722.tar.gz
src-856d8ddbb34d1816c5233b6f9155034a6a748722.zip
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
Notes
Notes: svn path=/head/; revision=298329
Diffstat (limited to 'sys/net/radix.c')
-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 b17858e4a016..62c2c3b6765a 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);
}