From: Christian Franke <[email protected]>

Signed-off-by: Christian Franke <[email protected]>
---
 bgpd/bgp_clist.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index 1f1a4e7..800bd01 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -402,17 +402,22 @@ community_str_get (struct community *com, int i)
 static int
 community_regexp_include (regex_t * reg, struct community *com, int i)
 {
-  const char *str;
+  char *str;
+  int rv;
 
   /* When there is no communities attribute it is treated as empty
  *      string.  */
   if (com == NULL || com->size == 0)
-    str = "";
+    str = XSTRDUP(MTYPE_COMMUNITY_STR, "");
   else
     str = community_str_get (com, i);
 
   /* Regular expression match.  */
-  if (regexec (reg, str, 0, NULL, 0) == 0)
+  rv = regexec (reg, str, 0, NULL, 0);
+
+  XFREE(MTYPE_COMMUNITY_STR, str);
+
+  if (rv == 0)
     return 1;
 
   /* No match.  */
-- 
2.8.0


_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to