I've tested your program. I guess the program and function shmalloc() return NULL from the use of the linked list inside body of shmalloc() and therefore you have already used a large number (about Million) of next pointer within the function shmalloc().
As I said:
I tried to figure out if it was the malloc call inside RCCE_shmalloc that returned NULL, but it wasn't (placed if(NULL) check after the RCCE_BLOCKs allocation).
so it is not the case that the malloc within RCCE_shmalloc returned NULL.