Fix for:
CID 717112 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable io_ctx going out of scope leaks
the storage it points to.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
int run(void)
{
+ int ret_val = 0;
rados_t cl;
RETURN1_IF_NONZERO(rados_create(&cl, NULL));
rados_conf_parse_argv(cl, m_argc, m_argv);
for (int i = 0; i < r; ++i)
++d;
if (d == to_add.end()) {
- return -EDOM;
+ ret_val = -EDOM;
+ goto out;
}
std::string oid(d->second);
to_add.erase(d);
if (ret != 0) {
printf("%s: rados_write(%s) failed with error %d\n",
get_id_str(), oid.c_str(), ret);
- return ret;
+ ret_val = ret;
+ goto out;
}
++added;
if ((added % 25) == 0) {
printf("%s: added %d objects\n", get_id_str(), added);
+ out:
rados_ioctx_destroy(io_ctx);
rados_shutdown(cl);
- return 0;
+ return ret_val;
}
private:
std::string m_pool_name;