Originally Posted By: sivan
after allocation by malloc/sys_malloc/nx_alloc it is necessary immediately to fill variables with values (memset), and set pointers (at least to NULL). Only when this is done, you can assign individual values e.g. myarray[3] = 123; , as frankjiang suggested.

Please don't spread such rumours. You can assign individual values to a certain part of a memory whenever you want - without any restriction. For malloc it is of cause recommended to clear the memory area with memset or another mechanism, but in the case of sys_malloc it is pointless as sys_malloc clears the allocated memory area anyways.
Originally Posted By: The Mighty Manual
Returns:
void* pointer to the allocated memory area, or NULL when the allocation failed. The area is cleared to zero at allocation.


Always learn from history, to be sure you make the same mistakes again...