text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE590_Free_Memory_Not_on_Heap__delete_long_placement_new_66b.cpp
  Label Definition File: CWE590_Free_Memory_Not_on_Heap__delete.pointer.label.xml
  Template File: sources-sink-66b.tmpl.cpp
  */
  /*
   * @description
   * CWE: 590 Free Memory Not on Heap
   * BadSource: placement_new Data buffer is declared on the stack
   * GoodSource: Allocate memory on the heap
   * Sinks:
   *    BadSink : Print then free data
   * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  #include <wchar.h>
  
  namespace CWE590_Free_Memory_Not_on_Heap__delete_long_placement_new_66
  {
  
  #ifndef OMITBAD
  
  void badSink(long * dataArray[])
  {
      /* copy data out of dataArray */
      long * data = dataArray[2];
      printLongLine(*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(long * dataArray[])
  {
      long * data = dataArray[2];
      printLongLine(*data);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      delete data;
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  