]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: fix a memory leak in C_TwoContexts 3918/head
authorXiong Yiliang <xiongyiliang@xunlei.com>
Fri, 6 Mar 2015 04:46:49 +0000 (12:46 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 10 Mar 2015 06:34:56 +0000 (14:34 +0800)
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 <xiongyiliang@xunlei.com>
(cherry picked from commit f33cdbe485d0e4b78a46657bfcb8d5c02d24be69)

src/osdc/Objecter.h

index fef7cd42cabd681c550cb362191c4db350102e52..68c429d58f37cd44c4d2ed686e50caab5f95bcf6 100644 (file)
@@ -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;
     }
   };