From f8f0818c67e63eae75b257029e1af1aa2430699b Mon Sep 17 00:00:00 2001 From: Florin Iucha Date: Sat, 15 Dec 2018 12:44:42 -0500 Subject: [PATCH] Fix uninitialized members --- include/fmt/core.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 33830eef..dd7e488c 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -223,7 +223,7 @@ class basic_buffer { protected: // Don't initialize ptr_ since it is not accessed to save a few cycles. - basic_buffer(std::size_t sz) FMT_NOEXCEPT: size_(sz), capacity_(sz) {} + basic_buffer(std::size_t sz) FMT_NOEXCEPT: ptr_(FMT_NULL), size_(sz), capacity_(sz) {} basic_buffer(T *p = FMT_NULL, std::size_t sz = 0, std::size_t cap = 0) FMT_NOEXCEPT: ptr_(p), size_(sz), capacity_(cap) {} @@ -1328,7 +1328,9 @@ struct named_arg_base { mutable char data[ sizeof(basic_format_arg::type>)]; - named_arg_base(basic_string_view nm) : name(nm) {} + named_arg_base(basic_string_view nm) : name(nm) { + std::memset(data, 0, sizeof(data)); + } template basic_format_arg deserialize() const {