(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
analyzer/
CVE-2005-1689-dedupe-issue-2.c
       1  /* { dg-additional-options "-fanalyzer-show-duplicate-count" } */
       2  
       3  #include <stdlib.h>
       4  
       5  typedef struct _krb5_data {
       6    char *data;
       7  } krb5_data;
       8  
       9  /* Ensure that we de-duplicate the various paths to reach here,
      10     and only emit one diagnostic.  */
      11  
      12  void
      13  recvauth_common(krb5_data common)
      14  {
      15    free(common.data);
      16    free(common.data); /* { dg-warning "double-'free' of 'common.data'" "inner warning" } */
      17    /* { dg-warning "double-'free' of 'inbuf_a.data' " "inbuf_a warning" { target *-*-* } .-1 } */
      18    /* { dg-warning "double-'free' of 'inbuf_b.data' " "inbuf_b warning" { target *-*-* } .-2 } */
      19    /* { dg-message "2 duplicates" "duplicates notification" { xfail *-*-* } .-3 } */
      20  }
      21  
      22  void krb5_recvauth(krb5_data inbuf_a)
      23  {
      24    recvauth_common(inbuf_a);
      25  }
      26  
      27  void krb5_recvauth_version(krb5_data inbuf_b)
      28  {
      29    recvauth_common(inbuf_b);
      30  }