Fix some memory errors triggered by allocation failures (#1995)
Some low hanging fruits found using nallocfuzz. See: https://github.com/catenacyber/nallocfuzz See: https://github.com/google/oss-fuzz/pull/9902 Most of these errors are quite trivial to fix; the only exception is the stuff in the uthash. If the insertion fails (because of an allocation failure), we need to avoid some memory leaks. But the only way to check if the `HASH_ADD_*` failed, is to perform a new lookup: a bit costly, but we don't use that code in any critical data-path.
This commit is contained in:
@@ -133,7 +133,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
|
||||
f = fopen("/dev/null", "w");
|
||||
ac_automata_dump(a, f);
|
||||
fclose(f);
|
||||
if (f)
|
||||
fclose(f);
|
||||
|
||||
ac_automata_get_stats(a, &stats);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user