Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/newsmips/apbus Avoid memory leak in sonic_get.
details: https://anonhg.NetBSD.org/src/rev/28cb51a18476
branches: trunk
changeset: 355436:28cb51a18476
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Jul 29 02:21:30 2017 +0000
description:
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.
diffstat:
sys/arch/newsmips/apbus/if_sn.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r a97435ff381e -r 28cb51a18476 sys/arch/newsmips/apbus/if_sn.c
--- a/sys/arch/newsmips/apbus/if_sn.c Sat Jul 29 02:17:44 2017 +0000
+++ b/sys/arch/newsmips/apbus/if_sn.c Sat Jul 29 02:21:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $ */
+/* $NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $ */
/*
* National Semiconductor DP8393X SONIC Driver
@@ -16,7 +16,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.39 2017/07/29 02:21:30 riastradh Exp $");
#include "opt_inet.h"
@@ -1090,7 +1090,10 @@
if (datalen >= MINCLSIZE) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
- if (top) m_freem(top);
+ if (top)
+ m_freem(top);
+ else
+ m_freem(m);
return 0;
}
len = MCLBYTES;
Home |
Main Index |
Thread Index |
Old Index