(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
zlib-4.c
       1  #include <stdlib.h>
       2  #include <string.h>
       3  
       4  typedef unsigned char Byte;
       5  typedef unsigned int uInt;
       6  typedef unsigned long uLong;
       7  
       8  #define Z_NULL  0
       9  
      10  int test ()
      11  {
      12      uLong comprLen = 10000*sizeof(int);
      13      uLong uncomprLen = comprLen;
      14      Byte *compr    = (Byte*)calloc((uInt)comprLen, 1);
      15      Byte *uncompr  = (Byte*)calloc((uInt)uncomprLen, 1);
      16      if (compr == Z_NULL || uncompr == Z_NULL)
      17        {
      18  	return 1; /* { dg-warning "leak of 'uncompr'" "uncompr leak" } */
      19  	          /* { dg-warning "leak of 'compr'" "compr leak" { target *-*-* } .-1 } */
      20        }
      21      strcpy((char*)uncompr, "garbage");
      22      return 0; /* { dg-warning "leak of 'uncompr'" "uncompr leak" } */
      23  	      /* { dg-warning "leak of 'compr'" "compr leak" { target *-*-* } .-1 } */
      24  }