Fix memory leak 12/225912/3
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 25 Feb 2020 08:35:34 +0000 (17:35 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 26 Feb 2020 07:35:25 +0000 (07:35 +0000)
Change-Id: I3b3b52f983a14a82e5e188b33cdf1acbec495d24
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/unit_tests/common/smoke_utils.cc

index 7aed360..9320de1 100644 (file)
@@ -987,6 +987,7 @@ bool CopySmackAccess(const boost::filesystem::path& src,
   if (!access_label)
     return true;
   ret = smack_lsetlabel(dst.c_str(), access_label, SMACK_LABEL_ACCESS);
+  free(access_label);
   if (ret < 0) {
     LOG(ERROR) << "set access label to [" << dst << "] fail";
     return false;
@@ -1010,6 +1011,7 @@ bool CopySmackExec(const boost::filesystem::path& src,
   if (!exec_label)
     return true;
   ret = smack_lsetlabel(dst.c_str(), exec_label, SMACK_LABEL_EXEC);
+  free(exec_label);
   if (ret < 0) {
     LOG(ERROR) << "set exec label to [" << dst << "] fail";
     return false;
@@ -1033,6 +1035,7 @@ bool CopySmackMmap(const boost::filesystem::path& src,
   if (!mmap_label)
     return true;
   ret = smack_lsetlabel(dst.c_str(), mmap_label, SMACK_LABEL_MMAP);
+  free(mmap_label);
   if (ret < 0) {
     LOG(ERROR) << "set mmap label to [" << dst << "] fail";
     return false;