]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: use XMALLOC for ESI handling
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 1 Feb 2017 18:01:16 +0000 (19:01 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 14 Feb 2017 12:59:00 +0000 (13:59 +0100)
The memory allocation mecanism from frr is used.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_attr_evpn.c
bgpd/bgp_route.c

index 5969df211fc7be92446adb42bb3c01615185d21c..929b4c17c3323f1d16c1afdccb3b3e82438feecc 100644 (file)
@@ -155,7 +155,7 @@ char *esi2str(struct eth_segment_id *id)
                return NULL;
 
        val = id->val;
-       ptr = (char *)malloc((ESI_LEN * 2 + ESI_LEN - 1 + 1) * sizeof(char));
+       ptr = (char *)XMALLOC(MTYPE_TMP, (ESI_LEN * 2 + ESI_LEN - 1 + 1) * sizeof(char));
 
        snprintf(ptr, (ESI_LEN * 2 + ESI_LEN - 1 + 1),
                 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
index dd0abb675c25e72d2827a9403a5326d8a769b549..3d23fa4ca6b4bcfe8c6db0ff54a65a3ec7ab8548 100644 (file)
@@ -6611,7 +6611,7 @@ route_vty_out_overlay (struct vty *vty, struct prefix *p,
       struct eth_segment_id *id = &(attr->extra->evpn_overlay.eth_s_id);
       char *str = esi2str(id);
       vty_out (vty, "%s", str);
-      free(str);
+      XFREE (MTYPE_TMP, str);
       if (p->u.prefix_evpn.flags & IP_PREFIX_V4)
        {
           vty_out (vty, "/%s", inet_ntoa (attr->extra->evpn_overlay.gw_ip.ipv4));
@@ -10552,6 +10552,8 @@ bgp_config_write_network_evpn (struct vty *vty, struct bgp *bgp,
            vty_out (vty, "%s", VTY_NEWLINE);
             if (macrouter)
               XFREE (MTYPE_TMP, macrouter);
+            if (esi)
+              XFREE (MTYPE_TMP, esi);
          }
   return 0;
 }