Module Name:    src
Committed By:   gdt
Date:           Sat Apr 12 12:24:50 UTC 2014

Modified Files:
        src/sys/netinet: if_arp.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/netinet/if_arp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.155 src/sys/netinet/if_arp.c:1.156
--- src/sys/netinet/if_arp.c:1.155	Tue Feb 25 18:30:12 2014
+++ src/sys/netinet/if_arp.c	Sat Apr 12 12:24:50 2014
@@ -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 @@ revarprequest(struct ifnet *ifp)
 
 	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;

Reply via email to