]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: fix omap_store and dbomap leaks in mount
authorSamuel Just <sam.just@inktank.com>
Tue, 25 Sep 2012 22:35:39 +0000 (15:35 -0700)
committerSamuel Just <sam.just@inktank.com>
Wed, 26 Sep 2012 17:16:24 +0000 (10:16 -0700)
CID 717093: Resource leak (RESOURCE_LEAK)At (48): Variable "omap_store" going
out of scope leaks the storage it points to.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/os/FileStore.cc

index 2484acd96a85a71fe86400b60c46184004702e79..dcb251d74f630284f8517eaa45559c8c3468d38e 100644 (file)
@@ -1973,6 +1973,7 @@ int FileStore::mount()
     LevelDBStore *omap_store = new LevelDBStore(omap_dir);
     stringstream err;
     if (omap_store->init(err)) {
+      delete omap_store;
       derr << "Error initializing leveldb: " << err.str() << dendl;
       ret = -1;
       goto close_current_fd;
@@ -1980,6 +1981,7 @@ int FileStore::mount()
     DBObjectMap *dbomap = new DBObjectMap(omap_store);
     ret = dbomap->init(do_update);
     if (ret < 0) {
+      delete dbomap;
       derr << "Error initializing DBObjectMap: " << ret << dendl;
       goto close_current_fd;
     }
@@ -1987,6 +1989,7 @@ int FileStore::mount()
 
     if (g_conf->filestore_debug_omap_check && !dbomap->check(err2)) {
       derr << err2.str() << dendl;;
+      delete dbomap;
       ret = -EINVAL;
       goto close_current_fd;
     }