#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
typedef struct
{
    char* location;
    int temp;
    int numberOfRec;
}TEMP;
 
// Your wrapper functions
void *xCalloc(size_t numElements, size_t sizeofElement)
{
    return calloc(numElements, sizeofElement);
}
 
void *xRealloc(void *ptr, size_t newSize)
{
    return realloc(ptr, newSize);
}
 
void someFunction(TEMP* data)
{
    void *temp;
    temp = xRealloc (data->location, 10 * sizeof(char));
    if(temp == NULL)
    {
        // Ran out of memory
        exit(EXIT_FAILURE);
    }
    
    data->location = temp;
    strncpy(data->location, "Hello", 6); // 6 = 5 + 1 (for NULL terminator)
}
 
int main(void)
{
    TEMP* data = xCalloc (1, sizeof(TEMP));
    data->location = xCalloc (20, sizeof(char));
    printf("Before realloc: %d\n", strlen(data->location));
    someFunction(data);
    printf("After realloc: %d\n", strlen(data->location));
    
    if(data->location != NULL)
        free(data->location);
    if(data != NULL)
        free(data);
    return 0;
}