diff options
author | Kotresh HR <khiremat@redhat.com> | 2017-10-23 06:46:49 -0400 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-10-25 14:04:58 +0000 |
commit | 115bf4332307fa0f95688dcab73341adfa7071ed (patch) | |
tree | 8a9907953113c570d6c9ed8ead6cde8bfee1c995 | |
parent | 411a401f7e4f81f6a77eea1438a3a43c73e06104 (diff) |
libgfchangelog: Fix possible null pointer dereference
If pthread_attr_init fails, gf_msg uses this->name
where 'this' is not initialized yet. This patch fixes
the same.
> Change-Id: Ie004cbe1015a0d62fc3b5512e8954c5606eeeb5f
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
> BUG: 1505325
(cherry picked from commit 738c38f0efa7b4d4dab0cf23d00589d68e4eb88d)
Change-Id: Ie004cbe1015a0d62fc3b5512e8954c5606eeeb5f
Signed-off-by: Kotresh HR <khiremat@redhat.com>
BUG: 1503405
-rw-r--r-- | xlators/features/changelog/lib/src/gf-history-changelog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c index 0c2320097d4..b0ec2b0bb04 100644 --- a/xlators/features/changelog/lib/src/gf-history-changelog.c +++ b/xlators/features/changelog/lib/src/gf-history-changelog.c @@ -798,6 +798,12 @@ gf_history_changelog (char* changelog_dir, unsigned long start, pthread_attr_t attr; + this = THIS; + if (!this) { + ret = -1; + goto out; + } + ret = pthread_attr_init (&attr); if (ret != 0) { gf_msg (this->name, GF_LOG_ERROR, errno, @@ -806,12 +812,6 @@ gf_history_changelog (char* changelog_dir, unsigned long start, return -1; } - this = THIS; - if (!this) { - ret = -1; - goto out; - } - jnl = (gf_changelog_journal_t *) GF_CHANGELOG_GET_API_PTR (this); if (!jnl) { ret = -1; |