Browse Source

fixed the warnings/errors from cppcheck

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@702 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 15 years ago
parent
commit
d8f5c49d9e
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/lib/cc/cpp/data.cc

+ 3 - 1
src/lib/cc/cpp/data.cc

@@ -43,7 +43,7 @@ const unsigned char ITEM_LENGTH_8    = 0x20;
 const unsigned char ITEM_LENGTH_MASK = 0x30;
 
 static inline void
-throwParseError(const std::string error, const std::string file, int line = 0, int pos = 0)
+throwParseError(const std::string& error, const std::string& file, int line = 0, int pos = 0)
 {
     if (line != 0 || pos != 0) {
         std::stringstream ss;
@@ -574,6 +574,7 @@ decode_blob(std::stringstream& in, int& item_length)
 
     in.read(buf, item_length);
     if (in.fail()) {
+        delete[] buf;
         throw DecodeError();
     }
     buf[item_length] = 0;
@@ -593,6 +594,7 @@ decode_utf8(std::stringstream& in, int& item_length)
 
     in.read(buf, item_length);
     if (in.fail()) {
+        delete[] buf;
         throw DecodeError();
     }
     buf[item_length] = 0;