[En-Nut-Discussion] net/ipout.c memory leak
Stefan Hax
stefan at escherlogic.com
Sat Jun 5 07:15:39 CEST 2010
noticed a small memory leak in ../net/ipout.c during UDP broadcast failures.
code is:
NutIpOutput(..)
{
...
if (nif->if_type == IFT_ETHER)
rc = (*nif->if_output) (dev, ETHERTYPE_IP, ha,
nb_clone);
else if (nif->if_type == IFT_PPP)
rc = (*nif->if_output) (dev, PPP_IP, 0, nb_clone);
if (rc == 0) {
NutNetBufFree(nb_clone);
}
...
}
sugested:
NutIpOutput(..)
{
...
if (nif->if_type == IFT_ETHER)
rc = (*nif->if_output) (dev, ETHERTYPE_IP, ha,
nb_clone);
else if (nif->if_type == IFT_PPP)
rc = (*nif->if_output) (dev, PPP_IP, 0, nb_clone);
if(nb_clone) { /* <-- might be a better choice */
NutNetBufFree(nb_clone);
}
...
}
Regards, Stefan.
More information about the En-Nut-Discussion
mailing list