Description
I have detected a potential memory leak in sapi/fuzzer/fuzzer-unserializehash.c(line 43), sapi/fuzzer/fuzzer-unserialize.c(line 38) , sapi/fuzzer/fuzzer-json.c(line 39), sapi/fuzzer/fuzzer-mbregex.c(line 39)
I ran cppchecker on the fuzzer components and discovered several memory leaks. The issue is caused by the allocated memory for orig_data/ data which is not freed when fuzzer_request_startup() returns FAILURE. This happens because the function returns immediately without calling free(orig_data) / free(data), leading to a memory leak.
CppCheck Error Message:
fuzzer-json.c:39:3: error: Memory leak: data [memleak]
return 0;
fuzzer-mbregex.c:39:3: error: Memory leak: data [memleak]
return 0;
fuzzer-unserialize.c:38:3: error: Memory leak: orig_data [memleak]
return 0;
fuzzer-unserializehash.c:43:3: error: Memory leak: orig_data [memleak]
return 0;
I will submit a pull request with a fix shortly.
PHP Version
PHP 8.3
Operating System
No response
Description
I have detected a potential memory leak in
sapi/fuzzer/fuzzer-unserializehash.c(line 43),sapi/fuzzer/fuzzer-unserialize.c(line 38) ,sapi/fuzzer/fuzzer-json.c(line 39),sapi/fuzzer/fuzzer-mbregex.c(line 39)I ran cppchecker on the fuzzer components and discovered several memory leaks. The issue is caused by the allocated memory for
orig_data/datawhich is not freed whenfuzzer_request_startup()returnsFAILURE. This happens because the function returns immediately without callingfree(orig_data)/free(data), leading to a memory leak.CppCheck Error Message:
I will submit a pull request with a fix shortly.
PHP Version
PHP 8.3
Operating System
No response