Fixed memory leak in OICStrdup test
authorErich Keane <erich.keane@intel.com>
Fri, 12 Jun 2015 16:55:05 +0000 (09:55 -0700)
committerErich Keane <erich.keane@intel.com>
Fri, 12 Jun 2015 18:50:21 +0000 (18:50 +0000)
OICStrdup test didn't release its result memory, this fix
ensures that it is properly released.

Change-Id: Ieb271c5fbace45a730905de4dd02f2208bbf42e5
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1259
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/c_common/oic_string/test/linux/oic_string_tests.cpp

index 3c825ad..77f95ab 100644 (file)
@@ -36,6 +36,7 @@
 #include "gtest/gtest.h"
 
 #include <oic_string.h>
+#include <oic_malloc.h>
 
 const char SENTINEL_VALUE = 127;
 TEST(StringTests, StrdupNormalDup)
@@ -50,6 +51,8 @@ TEST(StringTests, StrdupNormalDup)
     EXPECT_NE(param, result);
 
     EXPECT_STREQ(param, result);
+
+    OICFree(result);
 }
 
 // Tests a normal copy where the buffer is exactly long enough