This is an automated email from the ASF dual-hosted git repository.
shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0a9c6e8 Fix memory leak in header_rewrite (#6986)
0a9c6e8 is described below
commit 0a9c6e8b12bdb50b3f88e9a53e64051db5e1115d
Author: Susan Hinrichs <[email protected]>
AuthorDate: Thu Jul 9 15:07:08 2020 -0500
Fix memory leak in header_rewrite (#6986)
---
plugins/header_rewrite/conditions.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/plugins/header_rewrite/conditions.cc
b/plugins/header_rewrite/conditions.cc
index 8bb3848..e785e26 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -344,12 +344,15 @@ ConditionUrl::append_value(std::string &s, const
Resources &res)
TSDebug(PLUGIN_NAME, " Scheme to match is: %.*s", i, q_str);
break;
case URL_QUAL_URL:
- case URL_QUAL_NONE:
- q_str = TSUrlStringGet(bufp, url, &i);
- s.append(q_str, i);
- TSDebug(PLUGIN_NAME, " URL to match is: %.*s", i, q_str);
+ case URL_QUAL_NONE: {
+ // TSUrlStringGet returns an allocated char * we must free
+ char *non_const_q_str = TSUrlStringGet(bufp, url, &i);
+ s.append(non_const_q_str, i);
+ TSDebug(PLUGIN_NAME, " URL to match is: %.*s", i, non_const_q_str);
+ TSfree(non_const_q_str);
break;
}
+ }
}
bool