From: Danny Al-Gaaf Date: Thu, 28 Jan 2016 10:46:08 +0000 (+0100) Subject: MergeDiff.cc: close 'sd' correctly at the end of do_merge_diff() X-Git-Tag: v10.0.4~86^2~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5128ac2cc08a87d6eef90f19c0e0f8c82d4a3d69;p=ceph.git MergeDiff.cc: close 'sd' correctly at the end of do_merge_diff() Fix for: CID 1265562 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_handle: Handle variable sd going out of scope leaks the handle. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/tools/rbd/action/MergeDiff.cc b/src/tools/rbd/action/MergeDiff.cc index f56ec1f27d02..7289e11c41df 100644 --- a/src/tools/rbd/action/MergeDiff.cc +++ b/src/tools/rbd/action/MergeDiff.cc @@ -377,7 +377,7 @@ static int do_merge_diff(const char *first, const char *second, done: if (pd > 2) close(pd); - if (sd > 2) + if (sd) close(sd); if (fd > 2) close(fd);