Fixing emalloc in memory.c