Memory leak in security spresource 15/24615/3
authorMats Wichmann <mats@linux.com>
Mon, 9 Apr 2018 15:52:53 +0000 (09:52 -0600)
committerMats Wichmann <mats@linux.com>
Tue, 10 Apr 2018 13:06:30 +0000 (13:06 +0000)
In TestEncodeDecode, a profile is allocated and filled;
it is unwound but not deallocated, leading to valgrind
memory leak report like this:

32 bytes in 1 blocks are definitely lost in loss record 130 of 271

The freeing change eliminates nine such reports, one for
each call to the function.

Change-Id: I8b1223f7b832d4fafac4d7225ea2544fc348a7a4
Signed-off-by: Mats Wichmann <mats@linux.com>
resource/csdk/security/unittest/spresource.cpp

index b115e42..305d135 100644 (file)
@@ -187,6 +187,7 @@ static void TestEncodeDecode(OicSecSp_t* spToTest, bool* propsToTest, bool check
 exit:
     OICFree(cborPayload);
     DeleteSpBinData(spDecoded);
+    OICFree(spDecoded);
 }
 
 // can pass in spProps = NULL;