You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "bryancall (via GitHub)" <gi...@apache.org> on 2024/05/22 18:16:04 UTC

[PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

bryancall opened a new pull request, #11386:
URL: https://github.com/apache/trafficserver/pull/11386

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall merged PR #11386:
URL: https://github.com/apache/trafficserver/pull/11386


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #11386:
URL: https://github.com/apache/trafficserver/pull/11386#issuecomment-2129792686

   Cherry-picked to v10.0.x


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on PR #11386:
URL: https://github.com/apache/trafficserver/pull/11386#issuecomment-2125524903

   [approve ci centos]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on code in PR #11386:
URL: https://github.com/apache/trafficserver/pull/11386#discussion_r1610491526


##########
plugins/header_rewrite/header_rewrite.cc:
##########
@@ -199,23 +199,22 @@ RulesConfig::parse_config(const std::string &fname, TSHttpHookID default_hook, c
     }
 
     // If we are at the beginning of a new condition, save away the previous rule (but only if it has operators).
-    if (p.is_cond() && add_rule(rule)) {
-      rule = nullptr;
+    if (p.is_cond() && add_rule(rule.get())) {
+      rule.release();

Review Comment:
   I wanted to check to return value of `add_rule()` before I released the pointer.   `add_rule()` checks to see if the `rule` is not a nullptr and has an operator before assigning the pointer and returning true..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Coverity 1545947: Resource leak in header_rewrite plugin [trafficserver]

Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #11386:
URL: https://github.com/apache/trafficserver/pull/11386#discussion_r1610474974


##########
plugins/header_rewrite/header_rewrite.cc:
##########
@@ -199,23 +199,22 @@ RulesConfig::parse_config(const std::string &fname, TSHttpHookID default_hook, c
     }
 
     // If we are at the beginning of a new condition, save away the previous rule (but only if it has operators).
-    if (p.is_cond() && add_rule(rule)) {
-      rule = nullptr;
+    if (p.is_cond() && add_rule(rule.get())) {
+      rule.release();

Review Comment:
   It's unfortunate that we still have to call `release()`. I wondered if we can `std::move` the `rule` and call `release()` in `add_rule` but it looks like the following code relies on whether `rule` becomes nullptr.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org