#include typedef struct MyTest MyTest; struct MyTest { /*@null@*/ /*@only@*/ void *data; }; /*@null@*/ static MyTest * my_test_new (void) { MyTest *test; test = (MyTest *) malloc (sizeof (MyTest)); if (!test) { return NULL; } memset (test, 0, sizeof (MyTest)); test->data = malloc (100); return test; } static void my_test_free (/*@only@*/ /*@null@*/ MyTest *test) { if (!test) { return; } if (test->data) { free (test->data); } free (test); } int main (/*@unused@*/ int argc, /*@unused@*/ char *argv[]) { /*@null@*/ MyTest *test; test = my_test_new (); my_test_free (test); return 0; }