From bb20b159f35455c41a8f077724f685508e0823b6 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 23 Jun 2017 18:09:38 -0400 Subject: addr_types: replace DISSECTOR_ASSERT() with g_assert() DISSECTOR_ASSERT() can be used only when we're in wmem packet scope. It cannot be used during startup when address types are registered. In those cases, we must use g_assert(). If we still use DISSECTOR_ASSERT() and an assert is hit, we'll see a wmem assertion ** ERROR:../epan/wmem/wmem_core.c:52:wmem_alloc: assertion failed: (allocator->in_scope) Aborted instead of the actual assert output. Change-Id: Ife12ca3455d56ba4faa2dd6034df8a091d8641ed Reviewed-on: https://code.wireshark.org/review/22378 Reviewed-by: Michael Mann --- epan/address_types.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/epan/address_types.c b/epan/address_types.c index 56e9d227e6..2441e278a4 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -73,11 +73,11 @@ static void address_type_register(int addr_type, address_type_t *at) g_assert(type_list[addr_type] == NULL); /* Sanity check */ - DISSECTOR_ASSERT(at->name); - DISSECTOR_ASSERT(at->pretty_name); - DISSECTOR_ASSERT(at->addr_to_str); - DISSECTOR_ASSERT(at->addr_str_len); - DISSECTOR_ASSERT(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) || + g_assert(at->name); + g_assert(at->pretty_name); + g_assert(at->addr_to_str); + g_assert(at->addr_str_len); + g_assert(((at->addr_name_res_str != NULL) && (at->addr_name_res_len != NULL)) || ((at->addr_name_res_str == NULL) && (at->addr_name_res_len == NULL))); type_list[addr_type] = at; @@ -91,16 +91,16 @@ int address_type_dissector_register(const char* name, const char* pretty_name, int addr_type; /* Ensure valid data/functions for required fields */ - DISSECTOR_ASSERT(name); - DISSECTOR_ASSERT(pretty_name); - DISSECTOR_ASSERT(to_str_func); - DISSECTOR_ASSERT(str_len_func); + g_assert(name); + g_assert(pretty_name); + g_assert(to_str_func); + g_assert(str_len_func); /* Either have both or neither */ - DISSECTOR_ASSERT(((name_res_str_func != NULL) && (name_res_len_func != NULL)) || + g_assert(((name_res_str_func != NULL) && (name_res_len_func != NULL)) || ((name_res_str_func == NULL) && (name_res_len_func == NULL))); /* This shouldn't happen, so flag it for fixing */ - DISSECTOR_ASSERT(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE); + g_assert(num_dissector_addr_type < MAX_DISSECTOR_ADDR_TYPE); addr_type = AT_END_OF_LIST+num_dissector_addr_type; dissector_type_addresses[num_dissector_addr_type].addr_type = addr_type; -- cgit v1.2.1