When running the following code through splint, I get two warnings that
I don't fully understand.
This is the code :
---
typedef struct
{
int *pData;
} t_MyStruct;
static t_MyStruct myStruct =
{
(void *)0
};
static int myData = 0;
void process(void)
{
myStruct.pData = &myData;
}
---
And here are the warnings :
---
Splint 3.1.1 --- 12 April 2003
< loading standard library C:\Programme\splint-3.1.1\lib\standard.lcd
..... >
< preprocessing >
< checking test.c >
test.c: (in function process)
test.c(16,3): Implicitly only storage myStruct.pData (type int *) not
released
before assignment: myStruct.pData = &myData
A memory leak has been detected. Only-qualified storage is not
released
before the last reference to it is lost. (Use -mustfreeonly to
inhibit
warning)
test.c(16,3): Immediate address &myData assigned to implicitly only:
myStruct.pData = &myData
An immediate address (result of & operator) is transferred
inconsistently.
(Use -immediatetrans to inhibit warning)
< global checks >
Finished checking --- 2 code warnings
---
Anyone knows what's wrong with my code ?
Thanks for your help,
Guy.