fix the non initialized bug in StderrLogger. (#12839)

Summary:
This PR is intended to fix a potential uninitialized variable bug.

Fixes https://github.com/facebook/rocksdb/issues/12837

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12839

Reviewed By: ajkr

Differential Revision: D59398888

Pulled By: cbi42

fbshipit-source-id: 337391d7c1e73c0ff61797f88fbb4a8379500211
This commit is contained in:
WangQian 2024-07-08 15:59:02 -07:00 committed by Facebook GitHub Bot
parent 110ce5f4a3
commit f471e56190
1 changed files with 1 additions and 1 deletions

View File

@ -17,7 +17,7 @@ namespace ROCKSDB_NAMESPACE {
class StderrLogger : public Logger {
public:
explicit StderrLogger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
: Logger(log_level), log_prefix(nullptr) {}
: Logger(log_level), log_prefix(nullptr), log_prefix_len(0) {}
explicit StderrLogger(const InfoLogLevel log_level, const std::string prefix)
: Logger(log_level),
log_prefix(strdup(prefix.c_str())),