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