Fix a bug in which a potentially invalid usize replaced size

In the refactoring that unified the allocation paths, usize was substituted for
size. This worked fine under the default test configuration, but triggered
asserts when we started beefing up our CI testing.

This change fixes the issue, and clarifies the comment describing the argument
selection that it got wrong.
This commit is contained in:
David Goldblatt 2017-01-25 15:50:59 -08:00
parent 0874b648e0
commit 85d2841818

View File

@ -1652,10 +1652,10 @@ imalloc_body(static_opts_t *sopts, dynamic_opts_t *dopts) {
/* /*
* If dopts->alignment > 0, then ind is still 0, but usize was * If dopts->alignment > 0, then ind is still 0, but usize was
* computed in the previous if statement. Down the positive * computed in the previous if statement. Down the positive
* alignment path, imalloc_no_sample ind and size (relying only * alignment path, imalloc_no_sample ignores ind and size
* on usize). * (relying only on usize).
*/ */
allocation = imalloc_no_sample(sopts, dopts, tsd, usize, usize, allocation = imalloc_no_sample(sopts, dopts, tsd, size, usize,
ind); ind);
if (unlikely(allocation == NULL)) { if (unlikely(allocation == NULL)) {
goto label_oom; goto label_oom;