in src/map.c [170:218]
static int Map_IncreaseStorageKeysValues(MAP_HANDLE_DATA* handleData)
{
int result;
char** newKeys = realloc_flex(handleData->keys, sizeof(char*), handleData->count , sizeof(char*));
if (newKeys == NULL)
{
LogError("failure in realloc_flex(handleData->keys=%p, sizeof(char*)=%zu, handleData->count=%zu , sizeof(char*)=%zu);",
handleData->keys, sizeof(char*), handleData->count, sizeof(char*));
result = MU_FAILURE;
}
else
{
char** newValues;
handleData->keys = newKeys;
handleData->keys[handleData->count] = NULL;
newValues = realloc_flex(handleData->values, sizeof(char*), handleData->count, sizeof(char*));
if (newValues == NULL)
{
LogError("failure in realloc_flex(handleData->values=%p, sizeof(char*)=%zu, handleData->count=%zu, sizeof(char*)=%zu);",
handleData->values, sizeof(char*), handleData->count, sizeof(char*));
if (handleData->count == 0) /*avoiding an implementation defined behavior */
{
free(handleData->keys);
handleData->keys = NULL;
}
else
{
char** undoneKeys = realloc_2(handleData->keys, handleData->count, sizeof(char*));
if (undoneKeys == NULL)
{
LogError("CATASTROPHIC error, unable to undo through realloc to a smaller size");
}
else
{
handleData->keys = undoneKeys;
}
}
result = MU_FAILURE;
}
else
{
handleData->values = newValues;
handleData->values[handleData->count] = NULL;
handleData->count++;
result = 0;
}
}
return result;
}