Fix realloc failure check and use of reserved identifiers