Fix malloc initialization to avoid valgrind error