From: Danny Al-Gaaf Date: Fri, 28 Feb 2014 23:04:05 +0000 (+0100) Subject: ReplicatedPG.cc: fix ressource leak, delete cb X-Git-Tag: v0.78~108^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=500206d809f0cd85cd99e4f0ec164bbf74f92c28;p=ceph.git 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 32171c3ba4bbf..52a7690ab2f9c 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);