-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leaks in fuzzer modules detected by cppchecker #18081 #18082
Conversation
This affects lower branches too, please target the lowest supported bugfix branch, i.e. PHP-8.3. |
It's probably also better to just move the allocation under the request initialization, then you don't even need the call to |
This needs to be properly rebased when changing the target branch. |
c7a2bd0
to
eb98f36
Compare
eb98f36
to
c8da762
Compare
@TimWolla squashed and rebased over PHP-8.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabs vs spaces mixed up in all files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix indentation to use tabs
c8da762
to
8f3e032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
* PHP-8.3: Fix GH-18082: Memory leaks in fuzzer SAPI error paths
* PHP-8.4: Fix GH-18082: Memory leaks in fuzzer SAPI error paths
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
data
whenfuzzer_request_startup()
fails.fuzzer-unserialize.c (line 38):
Now frees
orig_data
before 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.