Motoyuki OHMORI <ohmori%tottori-u.ac.jp@localhost> writes:
>> 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;
That's byte-for-byte what I committed - KNF doesn't leave much room to
vary given the needed fix :-)
Attachment:
pgpHKqfhuTSt9.pgp
Description: PGP signature