(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
malloc-paths-7.c
       1  #include <stdlib.h>
       2  
       3  extern int foo (void);
       4  extern int bar (void);
       5  
       6  void test (void)
       7  {
       8    void *p = malloc (1024); /* { dg-message "\\(1\\) allocated here" } */ 
       9    void *q = malloc (1024);
      10  
      11    foo ();
      12    if (!q) /* { dg-message "\\(2\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." } */ 
      13      {
      14        free (q); /* { dg-message "\\(3\\) \\.\\.\\.to here" } */ 
      15        return; /* { dg-warning "leak of 'p'" "warning" } */ 
      16        /* { dg-message "\\(4\\) 'p' leaks here; was allocated at \\(1\\)" "event" { target *-*-* } .-1 } */
      17      }
      18    bar ();
      19    free (q);
      20    free (p);
      21  }