realloc result checking added, missing nullifying added for #70