Repository navigation
Conversation
Check the default pool pointer directly in gds__free. getDefaultMemoryPool() asserts that the pool still exists, so the previous null check did not protect the late process-exit path in debug builds.
dand-oss
marked this pull request as ready for review
October 7, 2026 10:10
dand-oss
force-pushed
the
fix/shutdown-free-guard
branch
from
October 7, 2026 10:10
8e001cb to
350e5d7
Compare
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.
gds__free()can be reached after the default memory pool has been cleaned up during process exit. Dereferencing the pool at that point crashes release builds. A guard throughgetDefaultMemoryPool()is insufficient in debug builds because that helper asserts that the default pool still exists; the assertion logging path itself re-enters pool-dependent code after cleanup.Check
MemoryPool::defaultMemoryManagerdirectly and skip the deallocation when the default pool is gone. The block is intentionally left to the operating system at that stage, andgds__freecontinues to return zero.Independently reproduced on Linux x86-64 against the ASan/UBSan debug Firebird 5 client built with
USE_SYSTEM_MALLOC=ON. A focused test compiled the actual productionsrc/yvalve/gds.cpp, linked it with the other production client objects, calledMemoryPool::cleanupDefaultPool(), then calledgds__free(NULL)and exited immediately:DEADLYSIGNAL/stack overflow through the debug pool assertion and logging path.getDefaultMemoryPool(): same failure, confirming the helper assertion defeats the null check.PASS: late gds__free returned.The patched current-master
gds.cppalso passes GCC 16.2 C++20 syntax compilation andgit diff --check. This is a focused late-cleanup reproduction, not an end-to-end WinGLUE shutdown run.