From: Yao Zongyou Date: Mon, 5 Mar 2018 02:57:38 +0000 (+0800) Subject: common: fix potential memory leak in HTMLFormatter X-Git-Tag: v13.0.2~91^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F20699%2Fhead;p=ceph.git common: fix potential memory leak in HTMLFormatter If HTMLFormatter::set_status called twice, memory will leaked, so fix it. Signed-off-by: Yao Zongyou --- diff --git a/src/common/HTMLFormatter.cc b/src/common/HTMLFormatter.cc index 5889566d74c4..1ad6a6d88e56 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); } };