Fix memory leak in clib_package_new#323
Merged
jwerle merged 1 commit intoclibs:masterfrom Dec 18, 2024
Merged
Conversation
Direct leak of 32 byte(s) in 1 object(s) allocated from:
0 malloc
1 json_object_init clib/deps/parson/parson.c:291:42
2 json_value_init_object clib/deps/parson/parson.c:1077:31
3 parse_object_value clib/deps/parson/parson.c:580:32
4 parse_value clib/deps/parson/parson.c:561:20
5 parse_object_value clib/deps/parson/parson.c:600:21
6 parse_value clib/deps/parson/parson.c:561:20
7 json_parse_string clib/deps/parson/parson.c:910:12
8 clib_package_new clib/src/common/clib-package.c:468:16
9 clib_package_load_from_manifest clib/src/common/clib-package.c:259:9
jwerle
approved these changes
Dec 18, 2024
Member
|
Thanks @tyler92! Could you please share more information on how this was discovered? I would like to automate scanning the codebase for memory leaks and your input could be very valuable. |
Contributor
Author
|
It was discovered by fuzzer integrated into OSS-Fuzz project. The main tool that helps to find such bugs (memory leaks, stack/heap buffer overflows, double free, etc) is Address sanitizer. So I just compiled it and launched it. I would recommend two things for automation:
|
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.
The leak was found by fuzzer: