Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet revarprequest: Avoid leaking mbuf.
details: https://anonhg.NetBSD.org/src/rev/53d326d960e1
branches: trunk
changeset: 328660:53d326d960e1
user: gdt <gdt%NetBSD.org@localhost>
date: Sat Apr 12 12:24:50 2014 +0000
description:
revarprequest: Avoid leaking mbuf.
In revarprequest, an mbuf could perhaps be leaked in an error path.
My reading of the code is that this is not possible, because ar_pro is
set to ETHERNET_IP, and ar_tha can only be null in the 1394 case.
But, better to have the free call anyway; ar_tha does not have a
documented interface contract :-)
Pointed out by Maxime Villard.
diffstat:
sys/netinet/if_arp.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 6ba3c5cc274d -r 53d326d960e1 sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c Sat Apr 12 09:09:47 2014 +0000
+++ b/sys/netinet/if_arp.c Sat Apr 12 12:24:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_arp.c,v 1.155 2014/02/25 18:30:12 pooka Exp $ */
+/* $NetBSD: if_arp.c,v 1.156 2014/04/12 12:24:50 gdt Exp $ */
/*-
* Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.155 2014/02/25 18:30:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.156 2014/04/12 12:24:50 gdt Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -1473,8 +1473,10 @@
memcpy(ar_sha(ah), CLLADDR(ifp->if_sadl), ah->ar_hln);
tha = ar_tha(ah);
- if (tha == NULL)
+ if (tha == NULL) {
+ m_free(m);
return;
+ }
memcpy(tha, CLLADDR(ifp->if_sadl), ah->ar_hln);
sa.sa_family = AF_ARP;
Home |
Main Index |
Thread Index |
Old Index