Right, the problem was that you need to allocate an 'int' for each pixel. The crash is in PTC trying to read too much data from your array.
If you're coding in C, you're much better off leaving off the type casts.
So I'd write it
unsigned int *buffer = malloc(RES_X*RES_Y* sizeof *buffer);
memset(buffer, 0, RES_X*RES_Y*sizeof *buffer);
ptc_update(buffer);
Many reasons for that
1) unsigned int is the correct type for pixels (shifting is ill-defined for signed values - who knew that eh?)
2) the type cast can hide errors
3) by using sizeof *buffer instead of sizeof(int) you remove one more place that you might need to change the code.
In C++, you need to write it like Stonemonkey says, the type casts are essential, but then in C++, you'd probably want to use
unsigned int *buffer = new unsigned int [RES_X*RES_Y];
Jim