aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2020-01-10 15:42:58 +0100
committerAnders Broman <a.broman58@gmail.com>2020-01-21 04:44:31 +0000
commit084a887a30b78a3f4f42aa35a15049c251adfcfa (patch)
treea28ee4be438301451dbb959ad9817ea563f5a878
parent567991b8fb7f1524d4860273ec0c01fd928bf353 (diff)
Fix compilation with gcc-9.
gcc-9 spotted some NULL pointer usages. Bug: 16319 Change-Id: I3e4ac57705f1852c43299f5e924fc642a2c56a3a Reviewed-on: https://code.wireshark.org/review/35733 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-gsm_a_bssmap.c4
-rw-r--r--epan/dissectors/packet-tnef.c15
-rw-r--r--plugins/epan/mate/mate_runtime.c2
-rw-r--r--ui/capture_ui_utils.c3
-rw-r--r--ui/cli/tap-stats_tree.c2
5 files changed, 12 insertions, 14 deletions
diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c
index c9aadd49d7..7547e949f5 100644
--- a/epan/dissectors/packet-gsm_a_bssmap.c
+++ b/epan/dissectors/packet-gsm_a_bssmap.c
@@ -1223,7 +1223,6 @@ bssmap_dissect_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3
{
guint8 oct;
guint32 curr_offset;
- const gchar *str = NULL;
curr_offset = offset;
@@ -1263,7 +1262,8 @@ bssmap_dissect_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3
curr_offset++;
if (add_string)
- g_snprintf(add_string, string_len, " - (%u) %s", oct & 0x7f, str);
+ g_snprintf(add_string, string_len, " - (%u) %s", oct & 0x7f,
+ rval_to_str_const(oct & 0x7f, gsm_a_bssap_cause_rvals, "Unknown"));
}
EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_extraneous_data);
diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c
index f987e83de0..b5fbd33697 100644
--- a/epan/dissectors/packet-tnef.c
+++ b/epan/dissectors/packet-tnef.c
@@ -363,6 +363,7 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
offset += 2;
if(tag & 0x80000000) {
+ const guint8* name_string = NULL;
/* it is a named property */
proto_tree_add_item(tag_tree, hf_tnef_property_tag_set, tvb, offset, 16, ENC_LITTLE_ENDIAN);
@@ -375,26 +376,24 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
if(tag_kind == 0) {
proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
-
- proto_item_append_text(prop_item, " [Named Property]");
} else {
- char *name_string = NULL;
-
tag_length = tvb_get_letohl(tvb, offset);
proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
- proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, tag_length, ENC_UTF_16|ENC_LITTLE_ENDIAN);
+ proto_tree_add_item_ret_string(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, tag_length,
+ ENC_UTF_16|ENC_LITTLE_ENDIAN, wmem_packet_scope(), &name_string);
offset += tag_length;
if((padding = (4 - tag_length % 4)) != 4) {
proto_tree_add_item(tag_tree, hf_tnef_property_padding, tvb, offset, padding, ENC_NA);
offset += padding;
}
-
- proto_item_append_text(prop_item, " [Named Property: %s]", name_string);
-
}
+ proto_item_append_text(prop_item, " [Named Property");
+ if (name_string)
+ proto_item_append_text(prop_item, ": %s", name_string);
+ proto_item_append_text(prop_item, "]");
}
switch(tag) {
diff --git a/plugins/epan/mate/mate_runtime.c b/plugins/epan/mate/mate_runtime.c
index 73dd7a99a6..c5f61888f9 100644
--- a/plugins/epan/mate/mate_runtime.c
+++ b/plugins/epan/mate/mate_runtime.c
@@ -431,8 +431,6 @@ static void analyze_gop(mate_config* mc, mate_gop* gop) {
/** Can't get here because of "breaks" above */
g_assert_not_reached();
}
-
- dbg_print (dbg_gog,1,dbg_facility,"analyze_gop: no gogkey_match: %s",key);
} /* while */
g_free(key);
diff --git a/ui/capture_ui_utils.c b/ui/capture_ui_utils.c
index 226030348a..f49e1ef5c9 100644
--- a/ui/capture_ui_utils.c
+++ b/ui/capture_ui_utils.c
@@ -573,7 +573,8 @@ get_iface_list_string(capture_options *capture_opts, guint32 style)
}
if (style & IFLIST_QUOTE_IF_DESCRIPTION)
g_string_append_printf(iface_list_string, "'");
- g_string_append_printf(iface_list_string, "%s", get_display_name_for_interface(capture_opts, i));
+ const gchar* name = get_display_name_for_interface(capture_opts, i);
+ g_string_append_printf(iface_list_string, "%s", name ? name : "");
if (style & IFLIST_QUOTE_IF_DESCRIPTION)
g_string_append_printf(iface_list_string, "'");
if (style & IFLIST_SHOW_FILTER) {
diff --git a/ui/cli/tap-stats_tree.c b/ui/cli/tap-stats_tree.c
index 4cf94f077d..ecdb3b6b61 100644
--- a/ui/cli/tap-stats_tree.c
+++ b/ui/cli/tap-stats_tree.c
@@ -74,7 +74,7 @@ init_stats_tree(const char *opt_arg, void *userdata _U_)
g_free(abbr);
} else {
- report_failure("could not obtain stats_tree abbr (%s) from arg '%s'", abbr, opt_arg);
+ report_failure("could not obtain stats_tree from arg '%s'", opt_arg);
return;
}