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

zwoop 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  0a42a46   Coverity 1022104 Dereference before null check
0a42a46 is described below

commit 0a42a463aa0b854159a966fbcd0776374d401ba5
Author: Leif Hedstrom <[email protected]>
AuthorDate: Sun May 14 11:08:13 2017 -0400

    Coverity 1022104 Dereference before null check
---
 proxy/http/remap/RemapPlugins.cc | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/proxy/http/remap/RemapPlugins.cc b/proxy/http/remap/RemapPlugins.cc
index 97327dd..410fb88 100644
--- a/proxy/http/remap/RemapPlugins.cc
+++ b/proxy/http/remap/RemapPlugins.cc
@@ -28,11 +28,14 @@ ClassAllocator<RemapPlugins> 
pluginAllocator("RemapPluginsAlloc");
 TSRemapStatus
 RemapPlugins::run_plugin(remap_plugin_info *plugin)
 {
+  ink_assert(_s);
+
   TSRemapStatus plugin_retcode;
   TSRemapRequestInfo rri;
   url_mapping *map = _s->url_map.getMapping();
   URL *map_from    = _s->url_map.getFromURL();
   URL *map_to      = _s->url_map.getToURL();
+  void *ih         = map->get_instance(_cur);
 
   // This is the equivalent of TSHttpTxnClientReqGet(), which every remap 
plugin would
   // have to call.
@@ -46,28 +49,8 @@ RemapPlugins::run_plugin(remap_plugin_info *plugin)
 
   rri.redirect = 0;
 
-// These are made to reflect the "defaults" that will be used in
-// the case where the plugins don't modify them. It's semi-weird
-// that the "from" and "to" URLs changes when chaining happens, but
-// it is necessary to get predictable behavior.
-#if 0
-  if (_cur == 0) {
-    rri.remap_from_host = map_from->host_get(&rri.remap_from_host_size);
-    rri.remap_from_port = map_from->port_get();
-    rri.remap_from_path = map_from->path_get(&rri.remap_from_path_size);
-    rri.from_scheme = map_from->scheme_get(&rri.from_scheme_len);
-  } else {
-    rri.remap_from_host = _request_url->host_get(&rri.remap_from_host_size);
-    rri.remap_from_port = _request_url->port_get();
-    rri.remap_from_path = _request_url->path_get(&rri.remap_from_path_size);
-    rri.from_scheme = _request_url->scheme_get(&rri.from_scheme_len);
-  }
-#endif
-
-  void *ih = map->get_instance(_cur);
-
   // Prepare State for the future
-  if (_s && _cur == 0) {
+  if (_cur == 0) {
     _s->fp_tsremap_os_response = plugin->fp_tsremap_os_response;
     _s->remap_plugin_instance  = ih;
   }

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to