text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE401_Memory_Leak__new_array_struct_twoints_63b.cpp
  Label Definition File: CWE401_Memory_Leak__new_array.label.xml
  Template File: sources-sinks-63b.tmpl.cpp
  */
  /*
   * @description
   * CWE: 401 Memory Leak
   * BadSource:  Allocate data using new[]
   * GoodSource: Point data to a stack buffer
   * Sinks:
   *    GoodSink: call delete[] on data
   *    BadSink : no deallocation of data
   * Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  namespace CWE401_Memory_Leak__new_array_struct_twoints_63
  {
  
  #ifndef OMITBAD
  
  void bad_sink(struct _twoints * * data_ptr)
  {
      struct _twoints * data = *data_ptr;
      /* POTENTIAL FLAW: No deallocation */
      ; /* empty statement needed for some flow variants */
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2B_sink(struct _twoints * * data_ptr)
  {
      struct _twoints * data = *data_ptr;
      /* POTENTIAL FLAW: No deallocation */
      ; /* empty statement needed for some flow variants */
  }
  
  /* goodB2G uses the BadSource with the GoodSink */
  void goodB2G_sink(struct _twoints * * data_ptr)
  {
      struct _twoints * data = *data_ptr;
      /* FIX: Deallocate memory */
      delete[] data;
  }
  
  #endif /* OMITGOOD */
  
  } // close namespace
  