From 5b3eee102398443cedbea589ea79eb3c5158741c Mon Sep 17 00:00:00 2001 From: Yao Zongyou Date: Mon, 5 Mar 2018 10:57:38 +0800 Subject: [PATCH] common: fix potential memory leak in HTMLFormatter If HTMLFormatter::set_status called twice, memory will leaked, so fix it. Signed-off-by: Yao Zongyou --- src/common/HTMLFormatter.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/HTMLFormatter.cc b/src/common/HTMLFormatter.cc index 5889566d74c40..1ad6a6d88e567 100644 --- a/src/common/HTMLFormatter.cc +++ b/src/common/HTMLFormatter.cc @@ -57,6 +57,9 @@ void HTMLFormatter::set_status(int status, const char* status_name) { m_status = status; if (status_name) { + if (m_status_name) { + free((void*)m_status_name); + } m_status_name = strdup(status_name); } }; -- 2.39.5