Static Analysis Problem Type Reference
Storage that was not previously assigned a value was accessed through a pointer.
Memory allocation routines do not necessarily initialize the storage they return.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
Uninitialized read |
The place where the uninitialized memory was read |
#include <stdio>
int main (int argc, char **argv)
{
int unknown; // uninitialized variable
int *p1 = &unknown;
int *p2 = (int *)malloc(4);
if (p2) {
printf("uninitialized values %d %d\n", *p1, *p2);
free(p2);
}
return 0;
}