don`t be use mallor ,free function,they are from c,if you use they,you memory will be lost.
in lite,you can use sys_malloc,sys_free,like this code.
typedef struct
{
char fitness;
int* dna;
}organism;
void main(){
organism* Agent = sys_malloc(sizeof(organism));
Agent.dna = sys_malloc(5*sizeof(int));
//reset your memory,make all is '\0'
memset(Agent.dna,'\0',5);
//and than set your varible
(Agent.dna)[3] = 12;
printf("%d", (Agent.dna)[3]);
sys_free(Agent.dna);
sys_free(Agent);
}