Fix memory leaks in fuzzer modules detected by cppchecker #18081#18082
Closed
Lung-Alexandra wants to merge 1 commit intophp:PHP-8.3from
Closed
Fix memory leaks in fuzzer modules detected by cppchecker #18081#18082Lung-Alexandra wants to merge 1 commit intophp:PHP-8.3from
Lung-Alexandra wants to merge 1 commit intophp:PHP-8.3from
Conversation
Member
|
This affects lower branches too, please target the lowest supported bugfix branch, i.e. PHP-8.3. |
Member
|
It's probably also better to just move the allocation under the request initialization, then you don't even need the call to |
Member
|
This needs to be properly rebased when changing the target branch. |
c7a2bd0 to
eb98f36
Compare
eb98f36 to
c8da762
Compare
Contributor
Author
|
@TimWolla squashed and rebased over PHP-8.3 |
staabm
reviewed
Mar 16, 2025
Contributor
staabm
left a comment
There was a problem hiding this comment.
tabs vs spaces mixed up in all files
ndossche
requested changes
Mar 16, 2025
Member
ndossche
left a comment
There was a problem hiding this comment.
Please fix indentation to use tabs
c8da762 to
8f3e032
Compare
ndossche
added a commit
that referenced
this pull request
Mar 16, 2025
* PHP-8.3: Fix GH-18082: Memory leaks in fuzzer SAPI error paths
ndossche
added a commit
that referenced
this pull request
Mar 16, 2025
* PHP-8.4: Fix GH-18082: Memory leaks in fuzzer SAPI error paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #18081.
This pull request addresses several memory leak issues detected by cppchecker in the following files:
fuzzer-json.c (line 39):
Added a
free(data)call to release the allocated memory before returning.fuzzer-mbregex.c (line 39):
Implemented a similar fix by freeing the allocated memory for
datawhenfuzzer_request_startup()fails.fuzzer-unserialize.c (line 38):
Now frees
orig_databefore returning when an error is detected.fuzzer-unserializehash.c (line 43):
Modified the error path to call
free(orig_data)iffuzzer_request_startup()fails.These changes ensure that memory allocated is properly released if
fuzzer_request_startup()fails, preventing memory leaks.