From 93a159875aa081cf3452754b890d83ae7c2bf943 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 15 Oct 2012 08:12:23 -0400 Subject: Fix: Address a few minor issues identified by cppcheck This patch addresses a number of smaller issues identified by the code inspection utility cppcheck. There are a number of identified leaks in the arm/linux/system.cc (although the function only get's called once so it is not a major problem), a few deletes in dev/x86/i8042.cc that were not array deletes, and sprintfs where the character array had one element less than needed. In the IIC tags there was a function allocating an array of longs which is in fact never used. --- src/dev/x86/i8042.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dev/x86') diff --git a/src/dev/x86/i8042.cc b/src/dev/x86/i8042.cc index 1e6464815..1fc50db15 100644 --- a/src/dev/x86/i8042.cc +++ b/src/dev/x86/i8042.cc @@ -490,7 +490,7 @@ X86ISA::PS2Keyboard::serialize(const std::string &base, std::ostream &os) } arrayParamOut(os, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); - delete buffer; + delete[] buffer; } void @@ -506,7 +506,7 @@ X86ISA::PS2Keyboard::unserialize(const std::string &base, Checkpoint *cp, for (int i = 0; i < bufferSize; ++i) { outBuffer.push(buffer[i]); } - delete buffer; + delete[] buffer; } void @@ -523,7 +523,7 @@ X86ISA::PS2Mouse::serialize(const std::string &base, std::ostream &os) } arrayParamOut(os, base + ".outBuffer.elts", buffer, bufferSize*sizeof(uint8_t)); - delete buffer; + delete[] buffer; paramOut(os, base + ".status", statusData); paramOut(os, base + ".resolution", resolution); paramOut(os, base + ".sampleRate", sampleRate); @@ -543,7 +543,7 @@ X86ISA::PS2Mouse::unserialize(const std::string &base, Checkpoint *cp, for (int i = 0; i < bufferSize; ++i) { outBuffer.push(buffer[i]); } - delete buffer; + delete[] buffer; paramIn(cp, section, base + ".status", statusData); paramIn(cp, section, base + ".resolution", resolution); paramIn(cp, section, base + ".sampleRate", sampleRate); -- cgit v1.2.3