diff options
author | Sverker Eriksson <[email protected]> | 2014-11-26 17:55:21 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2014-11-26 17:55:21 +0100 |
commit | 6c81a6bc42714a8a8483272e131d5982a40b341a (patch) | |
tree | ba27fc5d1254ac605c4aa926baee868fef888bff /erts/emulator/beam | |
parent | 1f34a16fc836d2e8a90f8485258a5f659735a3ff (diff) | |
parent | 6b435239e4eeb2bc57ef3e8ca8a2de48817b5571 (diff) | |
download | otp-6c81a6bc42714a8a8483272e131d5982a40b341a.tar.gz otp-6c81a6bc42714a8a8483272e131d5982a40b341a.tar.bz2 otp-6c81a6bc42714a8a8483272e131d5982a40b341a.zip |
Merge branch 'sverk/port_get_data-race/OTP-12208' into maint
* sverk/port_get_data-race/OTP-12208:
erts: Fix port data memory allocation bug
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/erl_bif_port.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c index 64bd598ba6..7ce950e090 100644 --- a/erts/emulator/beam/erl_bif_port.c +++ b/erts/emulator/beam/erl_bif_port.c @@ -472,7 +472,7 @@ cleanup_old_port_data(erts_aint_t data) ErtsPortDataHeap *pdhp = (ErtsPortDataHeap *) data; size_t size; ERTS_SMP_DATA_DEPENDENCY_READ_MEMORY_BARRIER; - size = sizeof(ErtsPortDataHeap) + pdhp->hsize*(sizeof(Eterm) - 1); + size = sizeof(ErtsPortDataHeap) + (pdhp->hsize-1)*sizeof(Eterm); erts_schedule_thr_prgr_later_cleanup_op(free_port_data_heap, (void *) pdhp, &pdhp->later_op, @@ -508,7 +508,7 @@ erts_port_data_size(Port *prt) } else { ErtsPortDataHeap *pdhp = (ErtsPortDataHeap *) data; - return (Uint) sizeof(ErtsPortDataHeap) + pdhp->hsize*(sizeof(Eterm)-1); + return (Uint) sizeof(ErtsPortDataHeap) + (pdhp->hsize-1)*sizeof(Eterm); } } @@ -550,7 +550,7 @@ BIF_RETTYPE port_set_data_2(BIF_ALIST_2) hsize = size_object(BIF_ARG_2); pdhp = erts_alloc(ERTS_ALC_T_PORT_DATA_HEAP, - sizeof(ErtsPortDataHeap) + hsize*(sizeof(Eterm)-1)); + sizeof(ErtsPortDataHeap) + (hsize-1)*sizeof(Eterm)); hp = &pdhp->heap[0]; pdhp->off_heap.first = NULL; pdhp->off_heap.overhead = 0; |