From 500206d809f0cd85cd99e4f0ec164bbf74f92c28 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sat, 1 Mar 2014 00:04:05 +0100 Subject: [PATCH] ReplicatedPG.cc: fix ressource leak, delete cb CID 1188145 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable "cb" going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf --- src/osd/ReplicatedPG.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 32171c3ba4bb..52a7690ab2f9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5227,8 +5227,12 @@ int ReplicatedPG::fill_in_copy_get( ctx->obc, &out_attrs, true); - if (result < 0) + if (result < 0) { + if (cb) { + delete cb; + } return result; + } cursor.attr_complete = true; dout(20) << " got attrs" << dendl; } @@ -5250,6 +5254,9 @@ int ReplicatedPG::fill_in_copy_get( result = pgbackend->objects_read_sync( oi.soid, cursor.data_offset, left, &bl); if (result < 0) + if (cb) { + delete cb; + } return result; } assert(result <= left); -- 2.47.3