Static Analysis Problem Type Reference
The size of allocated memory is less than the size of the pointed-to type of the pointer to which it is assigned.
Usually, this error results from an incorrect size computation. This error often leads to a subsequent bounds violation.
|
ID |
Code Location |
Description |
|---|---|---|
|
1 |
Allocation site |
The place where the memory was allocated |
#include <stdlib.h>
typedef struct {
int f1;
int f2;
int f3;
} s1;
typedef struct {
int f1;
int f2;
} s2;
int main(int argc, char **argv)
{
s1 *p = (s1 *) malloc( sizeof(s2) ); // probably intended sizeof(s1)
free(p);
return 0;
}