Yes it's obvious that the code will break if it will not get sufficient memory for malloc().
What you can do here is add a statement like this ?
Now you will now where the HELL is happening ?Code:if(geneas[k]==NULL) printf("\n Not sufficient memory");
REALNAPSTER