]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: do not leak handler in get_handler() error path
authorSage Weil <sage@inktank.com>
Tue, 13 Aug 2013 18:16:17 +0000 (11:16 -0700)
committerSage Weil <sage@inktank.com>
Sun, 18 Aug 2013 18:45:36 +0000 (11:45 -0700)
If we fail to initialize, delete the handler.

Fixes (part of): #5949
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 810c52de36719c3ee6cf2bdf59d5cde8840bbe55)

src/rgw/rgw_rest.cc

index ee73bb94fa5ec872dced1ff02ba9c280fb69721b..571e486964227554ae20bb194cac5c9128424dd9 100644 (file)
@@ -1233,8 +1233,10 @@ RGWHandler *RGWREST::get_handler(RGWRados *store, struct req_state *s, RGWClient
     return NULL;
   }
   *init_error = handler->init(store, s, cio);
-  if (*init_error < 0)
+  if (*init_error < 0) {
+    m->put_handler(handler);
     return NULL;
+  }
 
   return handler;
 }