summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ef.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-01-13 23:24:09 +0000
committerrwatson <rwatson@FreeBSD.org>2006-01-13 23:24:09 +0000
commit34a0d93dc551bae5e6bd8c8baa56c898db238cff (patch)
treee16c2dfbd190f7a6ef12f054af97d41e814a5443 /sys/net/if_ef.c
parentceba9a0086d69c997a39411b5fbd5bf1c0204b08 (diff)
downloadFreeBSD-src-34a0d93dc551bae5e6bd8c8baa56c898db238cff.zip
FreeBSD-src-34a0d93dc551bae5e6bd8c8baa56c898db238cff.tar.gz
Check the right ifnet pointer to see if if_alloc() failed or not in
ef_clone(); we were testing the original ifnet, not the one allocated. When aborting ef_clone() due to if_alloc() failing, free the allocated efnet structure rather than leaking it. Noticed by: Coverity Prevent analysis tool MFC after: 3 days
Diffstat (limited to 'sys/net/if_ef.c')
-rw-r--r--sys/net/if_ef.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index 2c2828c..04262c6 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -473,8 +473,10 @@ ef_clone(struct ef_link *efl, int ft)
efp->ef_pifp = ifp;
efp->ef_frametype = ft;
eifp = efp->ef_ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL)
+ if (eifp == NULL) {
+ free(efp, M_IFADDR);
return (ENOSPC);
+ }
snprintf(eifp->if_xname, IFNAMSIZ,
"%sf%d", ifp->if_xname, efp->ef_frametype);
eifp->if_dname = "ef";
OpenPOWER on IntegriCloud