diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-01-13 15:13:40 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-01-13 23:14:13 +0000 |
commit | 63a3d043e3f14eebb0798a250d9aecdc8e89dfb9 (patch) | |
tree | 69a58dd4cadfc7f98669cba229e76fa8c60e0761 /plugins | |
parent | 9f5e4fb7a51741a286ce5bc92a6f335ed58587a2 (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 'plugins')
-rw-r--r-- | plugins/mate/mate_util.c | 6 | ||||
-rw-r--r-- | plugins/wimaxasncp/wimaxasncp_dict.l | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c index 7f8dff8c18..079b9ef94a 100644 --- a/plugins/mate/mate_util.c +++ b/plugins/mate/mate_util.c @@ -752,8 +752,7 @@ gchar* avpl_to_str(AVPL* avpl) { g_free(avp_s); } - r = s->str; - g_string_free(s,FALSE); + r = g_string_free(s,FALSE); /* g_strchug(r); ? */ return r; @@ -771,8 +770,7 @@ extern gchar* avpl_to_dotstr(AVPL* avpl) { g_free(avp_s); } - r = s->str; - g_string_free(s,FALSE); + r = g_string_free(s,FALSE); /* g_strchug(r); ? */ return r; diff --git a/plugins/wimaxasncp/wimaxasncp_dict.l b/plugins/wimaxasncp/wimaxasncp_dict.l index 4c37f74bd8..58136abb5a 100644 --- a/plugins/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/wimaxasncp/wimaxasncp_dict.l @@ -673,8 +673,7 @@ wimaxasncp_dict_t *wimaxasncp_dict_scan( if (dict_error->len > 0) { - *error = dict_error->str; - g_string_free(dict_error, FALSE); + *error = g_string_free(dict_error, FALSE); } else { |