*** glibc detected *** a.out: realloc()

This is a discussion on *** glibc detected *** a.out: realloc() within the C Programming forums, part of the General Programming Boards category; hi,
the following fuction work fine under windows. it allocation a new cell to a pointer set to NULL at ...

*** glibc detected *** a.out: realloc()

hi,
the following fuction work fine under windows. it allocation a new cell to a pointer set to NULL at begging of program.
Running on unix, the program works fine for the first 5 inputs of "months", but then i get this error:
*** glibc detected *** a.out: realloc()
the rest of the error attached after the code. No idea how debug this, as it works fine under windows....

void MoveRight(int* arr,int startPoint,int size)
{
/*loop get parameter from main and from startPoint till current
end off array move data one step right*/
for (; size>startPoint; size--)
arr[size]=arr[size-1];
}

By the way, is this really a good solution for the problem? It appears that you are calling realloc for an expansion of 4 bytes (the size of integer) - it seeems like a better approach would be to have a structure that holds the actual size and the max size, and when the actual size is too small, extend the max size by doubling it. Calls to realloc are fairly expensive.