aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/dfilter/syntax-tree.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/dfilter/syntax-tree.c b/epan/dfilter/syntax-tree.c
index 1bd88f88fd..162ddc5a9b 100644
--- a/epan/dfilter/syntax-tree.c
+++ b/epan/dfilter/syntax-tree.c
@@ -261,22 +261,26 @@ stnode_set_inside_parens(stnode_t *node, gboolean inside)
static char *
_node_tostr(stnode_t *node, gboolean pretty)
{
- const char *s;
+ char *s, *repr;
if (node->type->func_tostr == NULL)
- s = "FIXME";
+ s = g_strdup("FIXME");
else
s = node->type->func_tostr(node->data, pretty);
if (pretty)
- return g_strdup(s);
+ return s;
- return g_strdup_printf("%s<%s>", stnode_type_name(node), s);
+ repr = g_strdup_printf("%s<%s>", stnode_type_name(node), s);
+ g_free(s);
+ return repr;
}
const char *
stnode_tostr(stnode_t *node, gboolean pretty)
{
+ ws_assert_magic(node, STNODE_MAGIC);
+
if (pretty && node->repr_display != NULL)
return node->repr_display;