ReplicatedPG.cc: fix use of potentially invalid pointer

rollback_to may not be initialized if ret != 0.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
This commit is contained in:
Samuel Just 2011-01-19 12:06:17 -08:00
parent 4e3a4e2853
commit e6b9731d00

View File

@ -1637,7 +1637,6 @@ void ReplicatedPG::_rollback_to(OpContext *ctx, ceph_osd_op& op)
ObjectContext *rollback_to;
int ret = find_object_context(soid.oid, oi.oloc, snapid, &rollback_to, false);
sobject_t& rollback_to_sobject = rollback_to->obs.oi.soid;
if (ret) {
if (-ENOENT == ret) {
// there's no snapshot here, or there's no object.
@ -1655,6 +1654,7 @@ void ReplicatedPG::_rollback_to(OpContext *ctx, ceph_osd_op& op)
assert(0);
}
} else { //we got our context, let's use it to do the rollback!
sobject_t& rollback_to_sobject = rollback_to->obs.oi.soid;
if (ctx->clone_obc &&
(ctx->clone_obc->obs.oi.soid.snap == snapid)) {
//just cloned the rollback target, we don't need to do anything!