diff mbox

ceph: Release resource before return in BackedObject::download()

Message ID 1383139954-21951-1-git-send-email-liwang@ubuntukylin.com (mailing list archive)
State New, archived
Headers show

Commit Message

Li Wang Oct. 30, 2013, 1:32 p.m. UTC
Close file before return

Signed-off-by: Li Wang <liwang@ubuntukylin.com>
---
 src/tools/rados/rados_sync.cc |    1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/src/tools/rados/rados_sync.cc b/src/tools/rados/rados_sync.cc
index 03293d3..d2d6ab5 100644
--- a/src/tools/rados/rados_sync.cc
+++ b/src/tools/rados/rados_sync.cc
@@ -579,6 +579,7 @@  int BackedUpObject::download(IoCtx &io_ctx, const char *path)
     if (rlen < 0) {
       cerr << ERR_PREFIX << "download: io_ctx.read(" << rados_name << ") returned "
 	   << rlen << std::endl;
+      fclose(fp);
       return rlen;
     }
     if (rlen < CHUNK_SZ)