summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmocka.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index 32f7360..4b88026 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -722,9 +722,16 @@ static void free_symbol_map_value(const void *value,
SymbolMapValue * const map_value = (SymbolMapValue*)value;
const LargestIntegralType children = cast_ptr_to_largest_integral_type(cleanup_value_data);
assert_non_null(value);
- list_free(&map_value->symbol_values_list_head,
- children ? free_symbol_map_value : free_value,
- (void *) ((uintptr_t)children - 1));
+ if (children == 0) {
+ list_free(&map_value->symbol_values_list_head,
+ free_value,
+ NULL);
+ } else {
+ list_free(&map_value->symbol_values_list_head,
+ free_symbol_map_value,
+ (void *)((uintptr_t)children - 1));
+ }
+
free(map_value);
}