]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libradosstriper/striping.cc: fix resource leak
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 24 Feb 2015 08:21:17 +0000 (09:21 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 24 Feb 2015 08:27:36 +0000 (09:27 +0100)
Fix for:

CID 1221525 (#1 of 1): Resource leak (RESOURCE_LEAK)
 leaked_storage: Failing to save or free storage allocated
 by this->getObjName(soid, 0UL) leaks it.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/libradosstriper/striping.cc

index 9b26329c6fccf47188220f7cca02eccbf4c1472f..404256637f7e8fa06fca32b4734081fe5eb902e8 100644 (file)
@@ -230,7 +230,7 @@ TEST_P(StriperTestRT, StripedRoundtrip) {
     // recreate object
     ASSERT_EQ(0, striper.write(soid, bl1, testData.size*2, 0));
     // remove the object size attribute from the striped object
-    std::string firstOid = getObjName(soid, 0);
+    char* firstOid = getObjName(soid, 0);
     ASSERT_EQ(0, ioctx.rmxattr(firstOid, "striper.size"));
     // check that stat fails
     uint64_t size;
@@ -244,6 +244,7 @@ TEST_P(StriperTestRT, StripedRoundtrip) {
          object_nb++) {
       ASSERT_EQ(-ENOENT, ioctx.stat(getObjName(soid, object_nb), &size, &mtime));
     }
+    free(firstOid);
   }
 }