aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter/dfilter-macro.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-01-13 15:13:40 -0800
committerGuy Harris <guy@alum.mit.edu>2015-01-13 23:14:13 +0000
commit63a3d043e3f14eebb0798a250d9aecdc8e89dfb9 (patch)
tree69a58dd4cadfc7f98669cba229e76fa8c60e0761 /epan/dfilter/dfilter-macro.c
parent9f5e4fb7a51741a286ce5bc92a6f335ed58587a2 (diff)
Consistently use the "g_string_free returns a C string pointer" idiom.
g_string_free(str, FALSE) frees the GString container but not the underlying g_malloc()ed string; instead, it returns a pointer to the g_malloc()ed string. Fix those places that didn't already get the string pointer from g_string_free() to do so rather than manually extracting the string themselves. And fix one place that didn't even need to use a string - it was just scanning a C string without even modifying it. Change-Id: Ibbf4872bf5b9935b9907f539b6edb1013f3053a5 Reviewed-on: https://code.wireshark.org/review/6532 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dfilter/dfilter-macro.c')
-rw-r--r--epan/dfilter/dfilter-macro.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c
index ed2f245374..fef1f2c561 100644
--- a/epan/dfilter/dfilter-macro.c
+++ b/epan/dfilter/dfilter-macro.c
@@ -318,8 +318,7 @@ static const gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth,
*error = "end of filter in the middle of a macro expression";
goto on_error;
} case ';': {
- g_ptr_array_add(args,arg->str);
- g_string_free(arg,FALSE);
+ g_ptr_array_add(args,g_string_free(arg,FALSE));
arg = g_string_sized_new(32);
break;
@@ -337,10 +336,9 @@ static const gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth,
break;
} case '}': {
const gchar* resolved;
- g_ptr_array_add(args,arg->str);
+ g_ptr_array_add(args,g_string_free(arg,FALSE));
g_ptr_array_add(args,NULL);
- g_string_free(arg,FALSE);
arg = NULL;
resolved = dfilter_macro_resolve(name->str, (gchar**)args->pdata, error);