You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2024/05/09 21:06:58 UTC
(trafficserver) 05/14: Coverity 1534638: Resource leak in object for stale_response plugin (#11323)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 89afe2e50579b5b31b0635939cc5d27aa21c32ff
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue May 7 08:58:00 2024 -0600
Coverity 1534638: Resource leak in object for stale_response plugin (#11323)
(cherry picked from commit 607783448efa9c096025504c68d2e4b535c5d4cd)
---
plugins/experimental/stale_response/stale_response.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/plugins/experimental/stale_response/stale_response.h b/plugins/experimental/stale_response/stale_response.h
index 8dc44ae7fa..0fa4087d79 100644
--- a/plugins/experimental/stale_response/stale_response.h
+++ b/plugins/experimental/stale_response/stale_response.h
@@ -26,6 +26,7 @@
#include "ts/apidefs.h"
#include "ts_wrap.h"
#include "ts/ts.h"
+#include "BodyData.h"
#include <cstdint>
#include <map>
@@ -51,6 +52,18 @@ struct LogInfo {
struct ConfigInfo {
ConfigInfo() : body_data{new UintBodyMap()}, body_data_mutex(TSMutexCreate()) {}
+ ~ConfigInfo()
+ {
+ if (this->body_data) {
+ for (auto &it : *this->body_data) {
+ delete it.second;
+ }
+ delete this->body_data;
+ }
+ if (this->body_data_mutex) {
+ TSMutexDestroy(this->body_data_mutex);
+ }
+ }
UintBodyMap *body_data = nullptr;
TSMutex body_data_mutex;
int64_t body_data_memory_usage = 0;