[cppcheck][PATCH] found missmatch in allocation and deallocation of memory in debugger/src/type_array.cc #11

Open
orbitcowboy opened this Issue Jun 27, 2011 · 0 comments

Comments

Projects
None yet
1 participant

During a check with the static code analysis tool (cppcheck) the tool discovered an issue in file debugger/src/type_array.cc. There is a missmatch in allocation and deallocation of memory using the new and delete operator. Please refer the attached patch that fixes the issue.

Best regards from the cppcheck team

Martin

$ git diff
diff --git a/src/type_array.cc b/src/type_array.cc
index 3cd756e..e42d482 100644
--- a/src/type_array.cc
+++ b/src/type_array.cc
@@ -738,9 +738,9 @@ TypeArray::print_value(EvalContext & ctx, Value & value, int
try {
print_dim_fortran(context, this, value, 0, repmin, maxelem,
pretty, indent, indices, false, comma);

  •       delete indices;
    
  •       delete [] indices;
     } catch(...) {
    
  •       delete indices;
    
  •       delete [] indices;
        throw;
     }
     break;
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment