aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-09-04 19:38:53 +0200
committerSverker Eriksson <[email protected]>2014-09-04 19:38:53 +0200
commit35ff91189c8dd4ceed3d8f29536f500787ba4782 (patch)
tree7ee410b853ca2ad861c60409fa4fc5d65c3636a9 /erts/emulator
parentf5036330d46d2cc1d5995e89ae86d1b09ac83ac4 (diff)
parent05f748bfdaa4297ae45264ae9297cadb5f33966e (diff)
downloadotp-35ff91189c8dd4ceed3d8f29536f500787ba4782.tar.gz
otp-35ff91189c8dd4ceed3d8f29536f500787ba4782.tar.bz2
otp-35ff91189c8dd4ceed3d8f29536f500787ba4782.zip
Merge branch 'sverk/term_to_binary-realloc-size/OTP-12141' into maint
* sverk/term_to_binary-realloc-size/OTP-12141: erts: Fix bug in term_to_binary that reallocates binary with wrong size
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/external.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 8d240355b0..9b9b4b2a62 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1925,6 +1925,7 @@ static Eterm erts_term_to_binary_int(Process* p, Eterm Term, int level, Uint fla
}
real_size = endp - bytes;
result_bin = erts_bin_realloc(context->s.ec.result_bin,real_size);
+ result_bin->orig_size = real_size;
level = context->s.ec.level;
BUMP_REDS(p, (initial_reds - reds) / TERM_TO_BINARY_LOOP_FACTOR);
if (level == 0 || real_size < 6) { /* We are done */
@@ -2004,6 +2005,7 @@ static Eterm erts_term_to_binary_int(Process* p, Eterm Term, int level, Uint fla
erl_zlib_deflate_finish(&(context->s.cc.stream));
result_bin = erts_bin_realloc(context->s.cc.destination_bin,
context->s.cc.dest_len+6);
+ result_bin->orig_size = context->s.cc.dest_len+6;
context->s.cc.destination_bin = NULL;
pb = (ProcBin *) HAlloc(p, PROC_BIN_SIZE);
pb->thing_word = HEADER_PROC_BIN;