From e804df264c8e311d69244916977964f06243a614 Mon Sep 17 00:00:00 2001 From: Andrew Krieger Date: Mon, 28 Aug 2017 22:34:42 -0700 Subject: [PATCH] Fix potentially uninitialized struct used on MSVC Summary: MSVC warns this might be used but uninitialized. Force the struct to be zero initialized. Reviewed By: yfeldblum Differential Revision: D5585320 fbshipit-source-id: 9454a2a4a66c7689f42b1eb211dc57f5d3b88fea --- folly/SharedMutex.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index 0968f5ba..b6a1a263 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -850,6 +850,7 @@ class SharedMutexImpl { WaitContext& ctx) { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount; @@ -1005,6 +1006,7 @@ class SharedMutexImpl { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount; -- 2.34.1