release_handle - detect double release

76 Views Asked by At

I'm trying to get a handle (du-dum-tsh) on clang's acquire_handle and release_handle attributes. I've written

int create_foo(void) __attribute__((acquire_handle("foo")));
void destroy_foo(int __attribute__((release_handle("foo"))) foo);

void func(void)
{
    int foo = create_foo();
    destroy_foo(foo);
    destroy_foo(foo);
}

Though it compiles just fine, why doesn't

scan-build clang -c foo.c

detect the double release?

This is clang 14.0.0.

0

There are 0 best solutions below