aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/use-after-free-3.c
blob: b19fd3de49f412875749f10cb1231d09e7b89e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <stdlib.h>

void test_1 (int x, int y, int *out)
{
  int *ptr = (int *)malloc (sizeof (int));
  if (!ptr)
    return;
  *ptr = 19;

  free (ptr);
  *out = *ptr; /* { dg-warning "use after 'free' of 'ptr'" } */
}