Using a simple linked list implementation in C, how do I tell Splint that I am transfer ownership of data
?
typedef struct {
void* data;
/*@null@*/ void* next;
} list;
static /*@null@*/ list* new_list(/*@notnull@*/ void* data)
{
list* l;
l = malloc(sizeof(list));
if (l == NULL)
return NULL;
l->next = NULL;
l->data = data;
return l;
}
I get this error message:
Implicitly temp storage data assigned to implicitly
only: list->data = data
Temp storage (associated with a formal parameter) is transferred to a
non-temporary reference. The storage may be released or new aliases created.
(Use -temptrans to inhibit warning)
I want to tell Splint that responsibility of freeing data
is transfered to the list data-structure.