text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE590_Free_Of_Invalid_Pointer_Not_On_The_Heap__delete_array_char_static_65b.cpp
  Label Definition File: CWE590_Free_Of_Invalid_Pointer_Not_On_The_Heap__delete_array.label.xml
  Template File: sources-sink-65b.tmpl.cpp
  */
  /*
   * @description
   * CWE: 590 Free of Invalid Pointer Not on the Heap
   * BadSource: static Data buffer is declared static on the stack
   * GoodSource: Allocate memory on the heap
   * Sinks:
   *    BadSink : Print then free data
   * Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
   *
   * */
  
  #include "std_testcase.h"
  
  #include <wchar.h>
  
  namespace CWE590_Free_Of_Invalid_Pointer_Not_On_The_Heap__delete_array_char_static_65
  {
  
  #ifndef OMITBAD
  
  void bad_sink(char * data)
  {
      printLine(data);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      delete [] data;
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2B_sink(char * data)
  {
      printLine(data);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      delete [] data;
  }
  
  #endif /* OMITGOOD */
  
  } // close namespace
  