summaryrefslogtreecommitdiffstats
path: root/src/common/TracepointProvider.cc
diff options
context:
space:
mode:
authorBrad Hubbard <bhubbard@redhat.com>2016-12-24 00:23:31 +0100
committerBrad Hubbard <bhubbard@redhat.com>2016-12-30 01:04:11 +0100
commit756c2011e4d0bc45d85a6e88184c26c8eaaa8c48 (patch)
tree52cd1908e3cca0da84e068740375fc0f77a87b7a /src/common/TracepointProvider.cc
parentMerge pull request #12598 from ly798/typo-fix-in-docs (diff)
downloadceph-756c2011e4d0bc45d85a6e88184c26c8eaaa8c48.tar.xz
ceph-756c2011e4d0bc45d85a6e88184c26c8eaaa8c48.zip
tracing: Fix handle leak in TracepointProvider
Silences Coverity 1397733 Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
Diffstat (limited to 'src/common/TracepointProvider.cc')
-rw-r--r--src/common/TracepointProvider.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common/TracepointProvider.cc b/src/common/TracepointProvider.cc
index 7c3d453cdc3..92aa4033d6e 100644
--- a/src/common/TracepointProvider.cc
+++ b/src/common/TracepointProvider.cc
@@ -7,13 +7,16 @@
TracepointProvider::TracepointProvider(CephContext *cct, const char *library,
const char *config_key)
: m_cct(cct), m_library(library), m_config_keys{config_key, NULL},
- m_lock("TracepointProvider::m_lock"), m_enabled(false) {
+ m_lock("TracepointProvider::m_lock") {
m_cct->_conf->add_observer(this);
verify_config(m_cct->_conf);
}
TracepointProvider::~TracepointProvider() {
m_cct->_conf->remove_observer(this);
+ if (m_handle) {
+ dlclose(m_handle);
+ }
}
void TracepointProvider::handle_conf_change(
@@ -25,7 +28,7 @@ void TracepointProvider::handle_conf_change(
void TracepointProvider::verify_config(const struct md_config_t *conf) {
Mutex::Locker locker(m_lock);
- if (m_enabled) {
+ if (m_handle) {
return;
}
@@ -36,9 +39,6 @@ void TracepointProvider::verify_config(const struct md_config_t *conf) {
return;
}
- void *handle = dlopen(m_library.c_str(), RTLD_NOW);
- if (handle != NULL) {
- m_enabled = true;
- }
+ m_handle = dlopen(m_library.c_str(), RTLD_NOW);
}