Skip to content

Commit

Permalink
use correct size in resize verification
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansson committed Apr 27, 2018
1 parent 7918338 commit d181657
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ test_alloc(void) {
baseptr[ibyte] = (char)(ibyte & 0xFF);

size_t resize = (iloop * ipass + datasize[(iloop + ipass) % 7]) & 0x2FF;
size_t capsize = (size > resize ? resize : size);
baseptr = rprealloc(baseptr, resize);
for (size_t ibyte = 0; ibyte < (size > resize ? resize : size); ++ibyte) {
for (size_t ibyte = 0; ibyte < capsize; ++ibyte) {
if (baseptr[ibyte] != (char)(ibyte & 0xFF))
return -1;
}

size_t alignsize = (iloop * ipass + datasize[(iloop + ipass * 3) % 7]) & 0x2FF;
capsize = (capsize > alignsize ? alignsize : capsize);
baseptr = rpaligned_realloc(baseptr, 128, alignsize, resize, 0);
for (size_t ibyte = 0; ibyte < (size > alignsize ? alignsize : size); ++ibyte) {
for (size_t ibyte = 0; ibyte < capsize; ++ibyte) {
if (baseptr[ibyte] != (char)(ibyte & 0xFF))
return -1;
}
Expand Down

0 comments on commit d181657

Please sign in to comment.