diff options
author | paul <paul> | 2003-05-16 17:19:48 +0000 |
---|---|---|
committer | paul <paul> | 2003-05-16 17:19:48 +0000 |
commit | a4b70768b4d08683d16a1e8225411e429fb531d3 (patch) | |
tree | 7292e9fb8c75d76120bbf67c63d141d6cad37ec3 | |
parent | a0f6acd8a49906399e2ac73fde6406da552b2443 (diff) |
From: Gilad Arnold <gilad.arnold@terayon.com>
Subject: [zebra 19084] Re: suspected memory leakage upon static route
I believe this is a more complete patch, it also addresses
allocating/freeing of nexthop->ifname string buffer (1) using
XSTRDUP/XFREE macros (thus correctly updating memory statistics), and
(2) for all nexthop->type cases that carry an ifname string.
-rw-r--r-- | zebra/zebra_rib.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index f3b9fd65..1c381901 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -187,8 +187,8 @@ nexthop_delete (struct rib *rib, struct nexthop *nexthop) void nexthop_free (struct nexthop *nexthop) { - if (nexthop->type == NEXTHOP_TYPE_IFNAME && nexthop->ifname) - free (nexthop->ifname); + if (nexthop->ifname) + XFREE (0, nexthop->ifname); XFREE (MTYPE_NEXTHOP, nexthop); } @@ -215,7 +215,7 @@ nexthop_ifname_add (struct rib *rib, char *ifname) nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop)); memset (nexthop, 0, sizeof (struct nexthop)); nexthop->type = NEXTHOP_TYPE_IFNAME; - nexthop->ifname = strdup (ifname); + nexthop->ifname = XSTRDUP (0, ifname); nexthop_add (rib, nexthop); |