[splint-discuss] Splint and malloc
Phil Longstaff
plongstaff at rogers.com
Sun Feb 22 16:51:54 PST 2009
Is there any way of indicating to splint that if a struct with pointers is
malloc'ed and the pointers are given values, that the previous values don't
need to be freed because it is new memory?
Example:
typedef struct {
char* x;
} struct_t;
struct_t* s = malloc( sizeof(struct_t) );
s.x = malloc(10);
will give a warning that s.x is implied only and hasn't been freed, leading to
memory leak. However, since s is pointing to new storage, there isn't
anything to be freed.
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090222/56fe7bbf/attachment.html
More information about the splint-discuss
mailing list