repaired memory allocation problem in test.c