Hi splint users! I have recently started using splint and have encountered the following code warning:
Only storage Test[].Buf assigned to unqualified: *Buffer = Test[CurrentTest].Buf The only reference to this storage is transferred to another reference (e.g., by returning it) that does not have the only annotation. This may lead to a memory leak, since the new reference is not necessarily released. (Use -onlytrans to inhibit warning) Buffer is a return value of a function (void function(/*@out@*/int *Buffer)) The assignment of *Buffer (see above)is made just before the return statement of the function. Test is a data variable of a struct-type containing Buf, used within the module (.c). It is defined as: static Test_T Test[4]; where Test_Buf is of the same type as *Buffer, i.e. int. typedef struct _Test_T { int *Buf; int A; boolean B; } Test_T; When Test[4] is initialized, the following code warning appears: Implicitly only storage Test[].Buf (type int*) not released before assignment: Test[i].Buf = MemoryAddress_C; 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[].Buf will never be modified. Could someone please explain to me on how to solve this problem. Thanks! Emma --------------------------------------------------------------- Emma Wermström Software Engineer Saab Ericsson Space AB tel: 031-7354433 S-405 15 Goteborg mobil: 0708-375230 SWEDEN mail: [EMAIL PROTECTED] --------------------------------------------------------------