Skip to content

Commit

Permalink
tests: fix erasure-code premature deallocation of cct
Browse files Browse the repository at this point in the history
The setup function returns before the run function, the cct variable
must be a data member, not a local variable that gets de-allocated
before run() starts.

Signed-off-by: Loic Dachary <[email protected]>
  • Loading branch information
ldachary committed Dec 8, 2016
1 parent 96cf8a1 commit efa1e54
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/test/erasure-code/ceph_erasure_code.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace po = boost::program_options;
class ErasureCodeCommand {
po::variables_map vm;
ErasureCodeProfile profile;
boost::intrusive_ptr<CephContext> cct;
public:
int setup(int argc, char** argv);
int run();
Expand Down Expand Up @@ -82,7 +83,7 @@ int ErasureCodeCommand::setup(int argc, char** argv) {
ceph_options.push_back(i->c_str());
}

auto cct = global_init(
cct = global_init(
&def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
Expand Down
2 changes: 1 addition & 1 deletion src/test/erasure-code/ceph_erasure_code_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int ErasureCodeBench::setup(int argc, char** argv) {
ceph_options.push_back(i->c_str());
}

auto cct = global_init(
cct = global_init(
&def_args, ceph_options, CEPH_ENTITY_TYPE_CLIENT,
CODE_ENVIRONMENT_UTILITY,
CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
Expand Down
1 change: 1 addition & 0 deletions src/test/erasure-code/ceph_erasure_code_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ErasureCodeBench {
ErasureCodeProfile profile;

bool verbose;
boost::intrusive_ptr<CephContext> cct;
public:
int setup(int argc, char** argv);
int run();
Expand Down

0 comments on commit efa1e54

Please sign in to comment.