Version 2.4, fixes

Fix free not actually calling real_free.

Fix free dereferencing null ptr.

TODO fix bug where tracked data is not correctly removed during free.
This commit is contained in:
Stephen Seo 2024-06-27 14:00:39 +09:00
parent 3169bc0458
commit 23b851d8f3
3 changed files with 9 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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);
}
}