If you attempt to read or write to memory that was previously allocated, the result will be a conflict and the program will generate a memory error because the memory is not initialized.
Consequences
Using an uninitialized memory read generates a random data read runtime error.
Detecting the error
Typically, the IDE does not detect this type of error; however, the Memory Analysis tool does trap the condition of reading uninitialized data from a recently allocated memory region.
For a list of error messages returned by the Memory Analysis tool, see Summary of error messages for Memory Analysis.
How to address random data read issues
Use the calloc() function, which always initializes data with zeros (0).
Example
The following code shows an example of an uninitialized memory read:
int main(int argc, char ** argv){ char * ptr = NULL; ptr = malloc(13); if (argc>1) strcpy(ptr,"Hello World!"); ptr[12]=0; printf("%s\n",ptr); return 0; }