From: Xiong Yiliang Date: Fri, 6 Mar 2015 04:46:49 +0000 (+0800) Subject: osdc: fix a memory leak in C_TwoContexts X-Git-Tag: v9.0.0~196^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3890%2Fhead;p=ceph.git osdc: fix a memory leak in C_TwoContexts If an ObjectOperation op is cancelled, its destructor is called and each Context object in out_handler is deleted. A C_TwoContexts object can be one of these handlers. The two contexts wrapped in C_TwoContexts must be deleted as well. Signed-off-by: Xiong Yiliang --- diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index fef7cd42cabd..68c429d58f37 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -89,6 +89,13 @@ struct ObjectOperation { void finish(int r) { first->complete(r); second->complete(r); + first = NULL; + second = NULL; + } + + virtual ~C_TwoContexts() { + delete first; + delete second; } };