FS-10167: Fixed bug with ks_pool_resize allocating incorrectly based on recent allocation code changes. Added some missing files as well from prior commits related to libblade test projects and windows VS project property files.

This commit is contained in:
Shane Bryldt committed 2017-04-03 14:53:28 -06:00
1 parent 7861bb0d49
commit 7944934d20
8 files changed
+334 -2

No files matched your search

+28 -1
View File
@@ -1833,7 +1833,34 @@ KS_DECLARE(void *) ks_pool_resize_ex(ks_pool_t *mp_p, void *old_addr, const unsi
return NULL;
}
old_byte_size = prefix->size;
old_byte_size = prefix->size - PREFIX_SIZE - FENCE_SIZE - prefix->padding;
if (old_byte_size == new_byte_size) {
SET_POINTER(error_p, KS_STATUS_SUCCESS);
new_addr = old_addr;
goto end;
}
if (old_byte_size >= new_byte_size) {
unsigned long diff = old_byte_size - new_byte_size;
//prefix->size -= diff;
prefix->padding += diff;
write_magic((char *)prefix + prefix->size - prefix->padding - FENCE_SIZE);
SET_POINTER(error_p, KS_STATUS_SUCCESS);
new_addr = old_addr;
goto end;
}
{
unsigned long diff = new_byte_size - old_byte_size;
if (prefix->padding >= diff) {
prefix->padding -= diff;
write_magic((char *)prefix + prefix->size - prefix->padding - FENCE_SIZE);
SET_POINTER(error_p, KS_STATUS_SUCCESS);
new_addr = old_addr;
goto end;
}
}
/*
* If the size is larger than a block then the allocation must be at