From 42f6e99cfd2780023c4684fb2f6aed101cf98bdb Mon Sep 17 00:00:00 2001 From: Andrii Grynenko Date: Mon, 10 Apr 2017 23:14:38 -0700 Subject: [PATCH] Fix Fiber::LocalData leak for large fiber locals Summary: facepaw Reviewed By: yfeldblum Differential Revision: D4856227 fbshipit-source-id: 17a73d4d630c6efe1763bbd8aff8b7a2c7721c27 --- folly/fibers/Fiber.cpp | 4 ++++ folly/fibers/Fiber.h | 1 + 2 files changed, 5 insertions(+) diff --git a/folly/fibers/Fiber.cpp b/folly/fibers/Fiber.cpp index 39dcc333..f5995de3 100644 --- a/folly/fibers/Fiber.cpp +++ b/folly/fibers/Fiber.cpp @@ -189,6 +189,10 @@ void Fiber::preempt(State state) { } } +Fiber::LocalData::~LocalData() { + reset(); +} + Fiber::LocalData::LocalData(const LocalData& other) : data_(nullptr) { *this = other; } diff --git a/folly/fibers/Fiber.h b/folly/fibers/Fiber.h index 0fcd903d..36af25eb 100644 --- a/folly/fibers/Fiber.h +++ b/folly/fibers/Fiber.h @@ -131,6 +131,7 @@ class Fiber { class LocalData { public: LocalData() {} + ~LocalData(); LocalData(const LocalData& other); LocalData& operator=(const LocalData& other); -- 2.34.1