aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/external.c2
-rw-r--r--erts/emulator/test/map_SUITE.erl7
2 files changed, 8 insertions, 1 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 9a5ef56c47..458ebd8aa0 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -3899,7 +3899,6 @@ dec_term_atom_common:
/* Iterate through all the hamts and build tree nodes.
*/
if (hamt_list) {
- struct dec_term_hamt_placeholder* hamt = hamt_list;
ErtsHeapFactory factory;
factory.p = NULL;
@@ -3907,6 +3906,7 @@ dec_term_atom_common:
/* We assume heap will suffice (see hashmap_over_estimated_heap_size) */
do {
+ struct dec_term_hamt_placeholder* hamt = hamt_list;
*hamt->objp = erts_hashmap_from_array(&factory,
hamt->leafs,
hamt->size,
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index c421886431..91a5706320 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -1147,6 +1147,13 @@ t_map_encode_decode(Config) when is_list(Config) ->
97,55 % 55 :: integer()
>>),
+ %% many maps in same binary
+ MapList = lists:foldl(fun(K, [M|_]=Acc) -> [M#{K => K} | Acc] end,
+ [#{}],
+ lists:seq(1,100)),
+ MapList = binary_to_term(term_to_binary(MapList)),
+ MapListR = lists:reverse(MapList),
+ MapListR = binary_to_term(term_to_binary(MapListR)),
%% error cases
%% template: <<131,116,0,0,0,2,100,0,1,97,100,0,1,98,97,1,97,1>>