change emalloc + memset to ecalloc