(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
leak-pr105906.c
       1  /* { dg-additional-options "-Wno-analyzer-too-complex" } */
       2  
       3  #define NULL ((void *)0)
       4  
       5  #define LEN 64
       6  
       7  char **
       8  epystr_explode(const char *delim, char *str)
       9  {
      10  	char **out = NULL;
      11  	int i;
      12  
      13  	if (str == NULL || delim == NULL)
      14  		return NULL;
      15  
      16  	out = __builtin_malloc(LEN * sizeof(char *));
      17  	if (out == NULL)
      18  		return NULL;
      19  
      20  	for (i = 0; i < LEN; i++) {
      21  		out[i] = __builtin_strdup("bla");
      22  		if (out[i] == NULL) /* { dg-bogus "leak" } */
      23  			goto freem;
      24  	}
      25  	return out;
      26  
      27  freem:
      28  	while (--i >= 0)
      29  		__builtin_free(out[i]);
      30  	__builtin_free(out);
      31  	return NULL;
      32  }