You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ki...@apache.org on 2016/12/30 17:00:23 UTC

[trafficserver] branch master updated: TS-5041: fix leak in ts_lua plugin

This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  9313728   TS-5041: fix leak in ts_lua plugin
9313728 is described below

commit 9313728ecf81a7f145b2af4ea483c60da1fce241
Author: Kit Chan <ki...@apache.org>
AuthorDate: Thu Dec 29 21:17:26 2016 -0800

    TS-5041: fix leak in ts_lua plugin
---
 plugins/experimental/ts_lua/ts_lua_http.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/plugins/experimental/ts_lua/ts_lua_http.c b/plugins/experimental/ts_lua/ts_lua_http.c
index 5563232..e59284c 100644
--- a/plugins/experimental/ts_lua/ts_lua_http.c
+++ b/plugins/experimental/ts_lua/ts_lua_http.c
@@ -446,12 +446,10 @@ ts_lua_http_set_parent_proxy(lua_State *L)
     const char *hostname;
     size_t hostname_len;
     int port = 0;
-    const char *target;
 
     hostname = luaL_checklstring(L, 1, &hostname_len);
-    target   = TSstrndup(hostname, hostname_len);
     port     = luaL_checkinteger(L, 2);
-    TSHttpTxnParentProxySet(http_ctx->txnp, target, port);
+    TSHttpTxnParentProxySet(http_ctx->txnp, hostname, port);
   } else {
     return luaL_error(L, "incorrect # of arguments for set_parent_proxy, receiving %d instead of 2", n);
   }
@@ -619,15 +617,13 @@ static int
 ts_lua_http_server_push(lua_State *L)
 {
   const char *url;
-  const char *push_url;
   size_t url_len;
   ts_lua_http_ctx *http_ctx;
 
   GET_HTTP_CONTEXT(http_ctx, L);
 
-  url      = luaL_checklstring(L, 1, &url_len);
-  push_url = TSstrndup(url, url_len);
-  TSHttpTxnServerPush(http_ctx->txnp, push_url, url_len);
+  url = luaL_checklstring(L, 1, &url_len);
+  TSHttpTxnServerPush(http_ctx->txnp, url, url_len);
 
   return 0;
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].