From 63a3d043e3f14eebb0798a250d9aecdc8e89dfb9 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 13 Jan 2015 15:13:40 -0800 Subject: 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 --- echld/common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'echld/common.c') diff --git a/echld/common.c b/echld/common.c index dbc7924f99..5e9687ca14 100644 --- a/echld/common.c +++ b/echld/common.c @@ -411,7 +411,6 @@ echld_bool_t paramset_apply_em(param_t* paramset, enc_msg_t* em, char** err) { char* paramset_get_params_list(param_t* paramsets,const char* fmt) { param_t* p = paramsets; GString* str = g_string_new(""); - char* s; for (;p->name;p++) { g_string_append_printf(str,fmt, @@ -420,9 +419,7 @@ char* paramset_get_params_list(param_t* paramsets,const char* fmt) { p->desc); } - s = str->str; - g_string_free(str,FALSE); - return s; + return g_string_free(str,FALSE); } -- cgit v1.2.3