tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Memory leak in if_arp.c
Hi,
> after hearing about bouyer@'s mbuf leak problem, I launched my code scanner on
> netinet/, and it found a bug:
(snip)
> 'm' is leaked. However, this is not my area of working; can someone fix it?
>
> (and it doesn't solve his problem)
How about this? It may not be directly relevant to his problem though.
*** src/sys/netinet/if_arp.c.orig Sat Apr 12 19:07:24 2014
--- src/sys/netinet/if_arp.c Sat Apr 12 19:15:01 2014
***************
*** 1473,1480 ****
memcpy(ar_sha(ah), CLLADDR(ifp->if_sadl), ah->ar_hln);
tha = ar_tha(ah);
! if (tha == NULL)
return;
memcpy(tha, CLLADDR(ifp->if_sadl), ah->ar_hln);
sa.sa_family = AF_ARP;
--- 1473,1482 ----
memcpy(ar_sha(ah), CLLADDR(ifp->if_sadl), ah->ar_hln);
tha = ar_tha(ah);
! if (tha == NULL) {
! m_freem(m);
return;
+ }
memcpy(tha, CLLADDR(ifp->if_sadl), ah->ar_hln);
sa.sa_family = AF_ARP;
Best regards,
--
Motoyuki OHMORI <ohmori%tottori-u.ac.jp@localhost>
On Sat, Apr 12, 2014 at 11:12:47 +0200, Maxime Villard
<max%M00nBSD.net@localhost> wrote:
> Hi,
> after hearing about bouyer@'s mbuf leak problem, I launched my code scanner on
> netinet/, and it found a bug:
>
> -------------------------- netinet/if_arp.c l.1476 --------------------------
>
> if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL)
> return;
> [...]
> if (tha == NULL)
> return;
>
> -----------------------------------------------------------------------------
>
> 'm' is leaked. However, this is not my area of working; can someone fix it?
>
> (and it doesn't solve his problem)
>
> Regards,
> Maxime
Home |
Main Index |
Thread Index |
Old Index