owasp-modsecurity / ModSecurity

ModSecurity is an open source, cross platform web application firewall (WAF) engine for Apache, IIS and Nginx. It has a robust event-based programming language which provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.
https://www.modsecurity.org
Apache License 2.0
7.67k stars 1.54k forks source link

fix: Sonarcloud memleak fixes #3114

Open airween opened 1 month ago

airween commented 1 month ago

This pull request fixes two memory leaks, reported by SonarCloud.

None of them modified the library itself.

airween commented 1 month ago

This block makes no sense.

The variable is initialized as an empty string in line 49 in each cycle.

49.      std::string argFull("");

therefore the condition's left side (argFull.empty()) is always true which means the condition itself

54.        if (argFull.empty() == false) {

is always false. Moreover, in the two branches in that block after the append() the code jumps to the next label, where the cycle ends...

So I'm going to remove it.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud