text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE590_Free_Memory_Not_on_Heap__delete_array_wchar_t_static_73b.cpp
  Label Definition File: CWE590_Free_Memory_Not_on_Heap__delete_array.label.xml
  Template File: sources-sink-73b.tmpl.cpp
  */
  /*
   * @description
   * CWE: 590 Free Memory Not on 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: 73 Data flow: data passed in a list from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  #include <list>
  
  #include <wchar.h>
  
  using namespace std;
  
  namespace CWE590_Free_Memory_Not_on_Heap__delete_array_wchar_t_static_73
  {
  
  #ifndef OMITBAD
  
  void badSink(list<wchar_t *> dataList)
  {
      /* copy data out of dataList */
      wchar_t * data = dataList.back();
      printWLine(data);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      delete [] data;
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2BSink(list<wchar_t *> dataList)
  {
      wchar_t * data = dataList.back();
      printWLine(data);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      delete [] data;
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  