[quagga-dev 10488] ripd/rip_interface.c memleak from inappropriate strdup() calls

Charlet, Ricky ricky.charlet at hp.com
Wed May 1 01:09:09 BST 2013


Howdy,
        I'm new around these parts and just jumping into quagga code.

        During review, I believe I've spotted a few memory leaks in ripd/rip_interface.c.  In several places, there are calls to stdlib.h's strdup() function. Memory returned from strdup() never seems to be free'd.  For example:

/* Add interface to rip_enable_if. */
static int
rip_enable_if_add (struct rip *rip, const char *ifname)
{
  int ret;

  ret = rip_enable_if_lookup (rip, ifname);
  if (ret >= 0)
    return -1;

  vector_set (rip->rip_enable_interface, strdup (ifname));

  rip_enable_apply_all (rip); /* TODOVJ */

  return 1;
}


        I'm just tossing this out as an FYI cause I've been wrong before (especially when I'm in a new code base). So will someone else put some eyeballs on that and see if you think those are true memleaks? And if they are not, I would love to be educated.

Thanks.
--
Ricky Charlet
Software Dev / Routing Dude: Aries team, Roseville CA
ricky.charlet at hp.com<mailto:ricky.charlet at hp.com>
USA: 916.785.2090







More information about the Quagga-dev mailing list