text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE590_Free_Memory_Not_on_Heap__free_int_declare_72b.cpp
  Label Definition File: CWE590_Free_Memory_Not_on_Heap__free.label.xml
  Template File: sources-sink-72b.tmpl.cpp
  */
  /*
   * @description
   * CWE: 590 Free Memory Not on Heap
   * BadSource: declare Data buffer is declared on the stack
   * GoodSource: Allocate memory on the heap
   * Sinks:
   *    BadSink : Print then free data
   * Flow Variant: 72 Data flow: data passed in a vector from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  #include <vector>
  
  #include <wchar.h>
  
  using namespace std;
  
  namespace CWE590_Free_Memory_Not_on_Heap__free_int_declare_72
  {
  
  #ifndef OMITBAD
  
  void badSink(vector<int *> dataVector)
  {
      /* copy data out of dataVector */
      int * data = dataVector[2];
      printIntLine(data[0]);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      free(data);
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2BSink(vector<int *> dataVector)
  {
      int * data = dataVector[2];
      printIntLine(data[0]);
      /* POTENTIAL FLAW: Possibly deallocating memory allocated on the stack */
      free(data);
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  