The creation of a temporary string for the ecommunity
was being leaked when debugging is enabled. Write
a bit of code to prevent this.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
sizeof(struct ecommunity));
}
+void ecommunity_strfree(char **s)
+{
+ XFREE(MTYPE_ECOMMUNITY_STR, *s);
+}
+
/* Allocate ecommunities. */
void ecommunity_free(struct ecommunity **ecom)
{
extern unsigned int ecommunity_hash_make(void *);
extern struct ecommunity *ecommunity_str2com(const char *, int, int);
extern char *ecommunity_ecom2str(struct ecommunity *, int, int);
+extern void ecommunity_strfree(char **s);
extern int ecommunity_match(const struct ecommunity *,
const struct ecommunity *);
extern char *ecommunity_str(struct ecommunity *);
BGP_FLOWSPEC_NLRI_STRING_MAX,
"EC{%s}",
s == NULL ? "none" : s);
+
+ if (s)
+ ecommunity_strfree(&s);
}
snprintf(local_string, BGP_FLOWSPEC_NLRI_STRING_MAX,
"FS Rx %s %s %s %s", withdraw ?