aboutsummaryrefslogtreecommitdiffstats
path: root/epan/value_string.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-05-11 04:22:20 +0000
committerGuy Harris <guy@alum.mit.edu>2016-05-11 04:22:26 +0000
commit2275e0273091314b38ed411a8cae39ed877f5bec (patch)
treed8875b2d8af62614cc5bb5a5b30121c5c3ec7fb2 /epan/value_string.c
parent1d0a97493280fd79d00e85a0971b3842d7f00e5e (diff)
Revert "Simplify val_to_str[_ext] implementation."
This reverts commit 1d0a97493280fd79d00e85a0971b3842d7f00e5e. This appears to be causing a crash - and the code in val_to_str() isn't just a copy of the code in val_to_str_wmem(), as it doesn't do a wmem allocation if try_val_to_str(), which *doesn't* use wmem, succeeds. Change-Id: I40e9e8b4ed0a1c66e20ab4bd827ac51c3fac85ff Reviewed-on: https://code.wireshark.org/review/15351 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/value_string.c')
-rw-r--r--epan/value_string.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/epan/value_string.c b/epan/value_string.c
index aac00ba9ec..298fd176ed 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -38,7 +38,15 @@
const gchar *
val_to_str(const guint32 val, const value_string *vs, const char *fmt)
{
- return val_to_str_wmem(wmem_packet_scope(), val, vs, fmt);
+ const gchar *ret;
+
+ DISSECTOR_ASSERT(fmt != NULL);
+
+ ret = try_val_to_str(val, vs);
+ if (ret != NULL)
+ return ret;
+
+ return wmem_strdup_printf(wmem_packet_scope(), fmt, val);
}
gchar *
@@ -309,7 +317,15 @@ try_val_to_str_idx_ext(const guint32 val, value_string_ext *vse, gint *idx)
const gchar *
val_to_str_ext(const guint32 val, value_string_ext *vse, const char *fmt)
{
- return val_to_str_ext_wmem(wmem_packet_scope(), val, vse, fmt);
+ const gchar *ret;
+
+ DISSECTOR_ASSERT(fmt != NULL);
+
+ ret = try_val_to_str_ext(val, vse);
+ if (ret != NULL)
+ return ret;
+
+ return wmem_strdup_printf(wmem_packet_scope(), fmt, val);
}
gchar *