You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "rnetuka (via GitHub)" <gi...@apache.org> on 2025/04/22 08:43:46 UTC

[PR] Resource leak in FileInputStreamCache [camel]

rnetuka opened a new pull request, #17823:
URL: https://github.com/apache/camel/pull/17823

   RESOURCE_LEAK (CWE-404)
   
   The out variable leaks if exception GeneralSecurityException is thrown
   


-- 
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: commits-unsubscribe@camel.apache.org

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


Re: [PR] Resource leak in FileInputStreamCache [camel]

Posted by "rnetuka (via GitHub)" <gi...@apache.org>.
rnetuka commented on code in PR #17823:
URL: https://github.com/apache/camel/pull/17823#discussion_r2053655190


##########
core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java:
##########
@@ -331,6 +331,7 @@ OutputStream createOutputStream(StreamCachingStrategy strategy) throws IOExcepti
                         ciphers = new CipherPair(strategy.getSpoolCipher());
                     }
                 } catch (GeneralSecurityException e) {
+                    out.close();

Review Comment:
   Done



-- 
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: commits-unsubscribe@camel.apache.org

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


Re: [PR] Resource leak in FileInputStreamCache [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #17823:
URL: https://github.com/apache/camel/pull/17823#discussion_r2053642161


##########
core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java:
##########
@@ -331,6 +331,7 @@ OutputStream createOutputStream(StreamCachingStrategy strategy) throws IOExcepti
                         ciphers = new CipherPair(strategy.getSpoolCipher());
                     }
                 } catch (GeneralSecurityException e) {
+                    out.close();

Review Comment:
   Can you use IOHelper.close(out)



-- 
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: commits-unsubscribe@camel.apache.org

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


Re: [PR] Resource leak in FileInputStreamCache [camel]

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


-- 
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: commits-unsubscribe@camel.apache.org

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


Re: [PR] Resource leak in FileInputStreamCache [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17823:
URL: https://github.com/apache/camel/pull/17823#issuecomment-2820605129

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :robot: CI automation will test this PR automatically.
   
   :camel: Apache Camel Committers, please review the following items:
   
   * First-time contributors **require MANUAL approval** for the GitHub Actions to run
   
   * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   * You can label PRs using `build-all`, `build-dependents`, `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
   
   * Build and test logs are available in the Summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary. 
   
   * :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

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