text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE762_Mismatched_Memory_Management_Routines__new_delete_array_int_54e.cpp
  Label Definition File: CWE762_Mismatched_Memory_Management_Routines__new_delete_array.label.xml
  Template File: sources-sinks-54e.tmpl.cpp
  */
  /*
   * @description
   * CWE: 762 Mismatched Memory Management Routines
   * BadSource:  Allocate data using new
   * GoodSource: Allocate data using new []
   * Sinks:
   *    GoodSink: Deallocate data using delete
   *    BadSink : Deallocate data using delete []
   * Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
   *
   * */
  
  #include "std_testcase.h"
  
  namespace CWE762_Mismatched_Memory_Management_Routines__new_delete_array_int_54
  {
  
  #ifndef OMITBAD
  
  void badSink_e(int * data)
  {
      /* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
       * require a call to delete to deallocate the memory */
      delete [] data;
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  void goodG2BSink_e(int * data)
  {
      /* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
       * require a call to delete to deallocate the memory */
      delete [] data;
  }
  
  /* goodB2G uses the BadSource with the GoodSink */
  void goodB2GSink_e(int * data)
  {
      /* FIX: Deallocate the memory using delete */
      delete data;
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  