Safety check: Don't directly abort.
The sized dealloc checks called the generic safety_check_fail, and then called abort. This means the failure case isn't mockable, hence not testable. Fix it in anticipation of a coming diff.
This commit is contained in:
parent
60993697d8
commit
53084cc5c2
@ -4,7 +4,6 @@
|
|||||||
static void (*safety_check_abort)(const char *message);
|
static void (*safety_check_abort)(const char *message);
|
||||||
|
|
||||||
void safety_check_fail_sized_dealloc(bool current_dealloc) {
|
void safety_check_fail_sized_dealloc(bool current_dealloc) {
|
||||||
assert(config_opt_safety_checks);
|
|
||||||
char *src = current_dealloc ? "the current pointer being freed" :
|
char *src = current_dealloc ? "the current pointer being freed" :
|
||||||
"in thread cache, possibly from previous deallocations";
|
"in thread cache, possibly from previous deallocations";
|
||||||
|
|
||||||
@ -12,7 +11,6 @@ void safety_check_fail_sized_dealloc(bool current_dealloc) {
|
|||||||
" application sized deallocation bugs (source: %s). Suggest building"
|
" application sized deallocation bugs (source: %s). Suggest building"
|
||||||
"with --enable-debug or address sanitizer for debugging. Abort.\n",
|
"with --enable-debug or address sanitizer for debugging. Abort.\n",
|
||||||
src);
|
src);
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void safety_check_set_abort(void (*abort_fn)(const char *)) {
|
void safety_check_set_abort(void (*abort_fn)(const char *)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user