[splint-discuss] Can't fit our memory management to Splint's model

Roman Cheplyaka roma at ro-che.info
Sat Jun 16 02:43:25 PDT 2007


Hi all!

We use nested structures like
struct s {
  struct s1 * f1;
  struct s2 * f2;
}
and each has its alloc and free function, e.g.
void s_free(struct s * f) {
  if ( f == NULL )
    return;
  s1_free(f->f1);
  s2_free(f->f2);
  free(f);
}
So, the contract is "s_free takes either NULL, or pointer to allocated
structure, whose members are allocated, too, and releases all of them".
The problem is that in one execution path (when f is NULL) f->f1 and
f->f2 are not released, and this confuses splint. How can I explain
splint that in this case they have not to be released?

-- 
Roman I. Cheplyaka
http://ro-che.info/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : http://www.cs.Virginia.EDU/pipermail/splint-discuss/attachments/20070616/9625e1af/attachment.bin


More information about the splint-discuss mailing list