From fc748e070fc1f6f53dcdba87b5cc9b0571da51da Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Wed, 27 Jan 2016 15:54:56 -0700 Subject: [PATCH] TS-4158 Adds appropriate releases of URL MLocs --- plugins/experimental/background_fetch/background_fetch.cc | 2 ++ plugins/experimental/channel_stats/channel_stats.cc | 1 + plugins/experimental/escalate/escalate.cc | 3 +-- plugins/header_rewrite/expander.cc | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/experimental/background_fetch/background_fetch.cc b/plugins/experimental/background_fetch/background_fetch.cc index d8438e46295..6b6d9e313e7 100644 --- a/plugins/experimental/background_fetch/background_fetch.cc +++ b/plugins/experimental/background_fetch/background_fetch.cc @@ -244,7 +244,9 @@ BgFetchData::initialize(TSMBuffer request, TSMLoc req_hdr, TSHttpTxn txnp) char *url = TSUrlStringGet(mbuf, url_loc, &len); _url.append(url, len); // Save away the URL for later use when acquiring lock + TSfree(static_cast(url)); + TSHandleMLocRelease(request, TS_NULL_MLOC, purl); if (TS_SUCCESS == TSHttpHdrUrlSet(mbuf, hdr_loc, url_loc)) { // Make sure we have the correct Host: header for this request. diff --git a/plugins/experimental/channel_stats/channel_stats.cc b/plugins/experimental/channel_stats/channel_stats.cc index b971d728f52..bfc11a67e2a 100644 --- a/plugins/experimental/channel_stats/channel_stats.cc +++ b/plugins/experimental/channel_stats/channel_stats.cc @@ -361,6 +361,7 @@ get_pristine_host(TSHttpTxn txnp, TSMBuffer bufp, std::string &host) } pristine_port = TSUrlPortGet(bufp, purl_loc); + TSHandleMLocRelease(bufp, TS_NULL_MLOC, purl_loc); host = std::string(pristine_host, pristine_host_len); if (pristine_port != 80) { char buf[12]; diff --git a/plugins/experimental/escalate/escalate.cc b/plugins/experimental/escalate/escalate.cc index 4a9b1c08f7c..c68c0b53584 100644 --- a/plugins/experimental/escalate/escalate.cc +++ b/plugins/experimental/escalate/escalate.cc @@ -129,13 +129,12 @@ EscalateResponse(TSCont cont, TSEvent event, void *edata) if (es->use_pristine) { if (TS_SUCCESS == TSHttpTxnPristineUrlGet(txn, &mbuf, &url)) { url_str = MakeEscalateUrl(mbuf, url, entry->second.target.c_str(), entry->second.target.size(), url_len); - printf("STRING is %.*s\n", url_len, url_str); + TSHandleMLocRelease(mbuf, TS_NULL_MLOC, url); } } else { if (TS_SUCCESS == TSHttpTxnClientReqGet(txn, &mbuf, &hdrp)) { if (TS_SUCCESS == TSHttpHdrUrlGet(mbuf, hdrp, &url)) { url_str = MakeEscalateUrl(mbuf, url, entry->second.target.c_str(), entry->second.target.size(), url_len); - printf("Old code STRING is %.*s\n", url_len, url_str); } // Release the request MLoc TSHandleMLocRelease(mbuf, TS_NULL_MLOC, hdrp); diff --git a/plugins/header_rewrite/expander.cc b/plugins/header_rewrite/expander.cc index 5d867e3622c..8c33a2c404d 100644 --- a/plugins/header_rewrite/expander.cc +++ b/plugins/header_rewrite/expander.cc @@ -66,6 +66,7 @@ VariableExpander::expand(const Resources &res) if (TSHttpTxnPristineUrlGet(res.txnp, &bufp, &url_loc) == TS_SUCCESS) { int len; resolved_variable = TSUrlSchemeGet(bufp, url_loc, &len); + TSHandleMLocRelease(bufp, TS_NULL_MLOC, url_loc); } } else if (variable == "%") { // Original port of the incoming request