From: Tudor Bosman Date: Sat, 9 Jun 2012 04:30:50 +0000 (-0700) Subject: D'oh: fix size computation in ThreadLocalDetail.h X-Git-Tag: v0.22.0~1275 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f05803b20b6701b76abcd923764565121a1c0535;p=folly.git D'oh: fix size computation in ThreadLocalDetail.h Test Plan: thread_local_test Reviewed By: ldemailly@fb.com FB internal diff: D490912 --- diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index 1d8fc7aa..de3ebb8a 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -271,8 +271,8 @@ struct StaticMeta { prevSize < jemallocMinInPlaceExpandable || (rallocm( static_cast(static_cast(&threadEntry_.elements)), - NULL, newSize, 0, ALLOCM_NO_MOVE | ALLOCM_ZERO) != - ALLOCM_SUCCESS)) { + NULL, newSize * sizeof(ElementWrapper), 0, + ALLOCM_NO_MOVE | ALLOCM_ZERO) != ALLOCM_SUCCESS)) { // Sigh, must realloc, but we can't call realloc here, as elements is // still linked in meta, so another thread might access invalid memory // after realloc succeeds. We'll copy by hand and update threadEntry_