]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librados: fix resources leakage in RadosClient::connect().
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 19 Jan 2015 14:07:21 +0000 (15:07 +0100)
committerLoic Dachary <ldachary@redhat.com>
Fri, 27 Feb 2015 18:14:44 +0000 (19:14 +0100)
commit1b2667211f90a1b630d2ddffe99b0fb00bb3c07c
tree973c9e1ade4713a60d1492a1d8535dfb7d7ad0dc
parent0820041e6515c82c41b81b9e6825e2dd5fcb8165
librados: fix resources leakage in RadosClient::connect().

If RadosClient::connect was called a second time (which could
happen as a part of recovery from failure), the instances
of Objecter and Messenger allocated by the first call were leaked.

Additionally, the implementation of the method wrongly reported
memory allocation problems -- it throwed std::bad_alloc exception
instead of returning -ENOMEM error code.

Fixes: #10425
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit 624c056da093c8741242892413438a291c03c7d5)

Conflicts:
src/librados/RadosClient.cc
        resolve adding (std::nothrow) that failed because the
        prototype of the constructor is not the same
src/librados/RadosClient.cc
src/test/librados/misc.cc