diff --git a/CMakeLists.txt b/CMakeLists.txt index e46be10..e71030a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(AnotherMemCheck) -set(AnotherMemCheck_VERSION 2.2) +set(AnotherMemCheck_VERSION 2.4) set(AnotherMemCheck_SOVERSION 2) set(AnotherMemCheck_SOURCES diff --git a/Changelog.md b/Changelog.md index 99aa516..65b26a5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,11 @@ # Changelog +## Version 2.4 + +Fixed free() not actually calling real_free(). + +Fixed nullptr dereference during free. + ## Version 2.3 Added ids to each chunk of allocated memory to make it easier to keep track of diff --git a/src/another_memcheck.cc b/src/another_memcheck.cc index 448141b..9c9a7a4 100644 --- a/src/another_memcheck.cc +++ b/src/another_memcheck.cc @@ -43,7 +43,7 @@ namespace SC_AM_Internal { ListNode *node = head; while (node != nullptr) { node = node->next; - if (node->data && node->data->address == ptr) { + if (node && node->data && node->data->address == ptr) { if (is_env_status == ANOTHER_MEMCHECK_QUIET_NOT_EXISTS) { std::clog << " id: " << node->data->id << std::endl; } @@ -141,6 +141,7 @@ namespace SC_AM_Internal { std::clog << "WARNING: Attempted free of unknown memory location!\n"; } else { result = true; + real_free(ptr); } }