Skip to content

Commit

Permalink
rgw: rgw_admin use raii for curl init/teardown
Browse files Browse the repository at this point in the history
Since a lot of rgw-admin commands can exit early

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 4667937)
  • Loading branch information
theanalyst committed Mar 6, 2018
1 parent 334da18 commit 50cf34a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/rgw/rgw_admin.cc
Expand Up @@ -2953,7 +2953,15 @@ int main(int argc, const char **argv)

rgw_user_init(store);
rgw_bucket_init(store->meta_mgr);
rgw::curl::setup_curl(boost::none);

struct rgw_curl_setup {
rgw_curl_setup() {
rgw::curl::setup_curl(boost::none);
}
~rgw_curl_setup() {
rgw::curl::cleanup_curl();
}
} curl_cleanup;

StoreDestructor store_destructor(store);

Expand Down Expand Up @@ -7111,6 +7119,5 @@ int main(int argc, const char **argv)
}
}

rgw::curl::cleanup_curl();
return 0;
}

0 comments on commit 50cf34a

Please sign in to comment.