cake icon indicating copy to clipboard operation
cake copied to clipboard

missing warning use after free.

Open thradams opened this issue 4 months ago • 0 comments

#pragma safety enable
void* _Owner _Opt malloc(unsigned long size);
void free(void* _Owner _Opt ptr);
void f(bool condition)
{    
   void * _Owner _Opt p = malloc(1);
   if (condition)
   {
     void * _Owner _Opt p2 = p;
     free(p2);
   }
   free(p);  //should have a warning here!

}

thradams avatar Oct 22 '24 18:10 thradams