gcc/testsuite/gcc.dg/analyzer/pr99269.c
raw| 1 | #include <stdlib.h> |
| 2 | |
| 3 | void example(void) { |
| 4 | int len; |
| 5 | int **namelist = NULL; |
| 6 | |
| 7 | len = 2; |
| 8 | namelist = malloc(len * sizeof *namelist); |
| 9 | if (!namelist) return; |
| 10 | namelist[0] = malloc(sizeof **namelist); |
| 11 | namelist[1] = malloc(sizeof **namelist); |
| 12 | |
| 13 | while(len--) { free(namelist[len]); } |
| 14 | free(namelist); |
| 15 | return; |
| 16 | } |