Avoid wiping full error context on release
All checks were successful
libakerror CI Build / cmake_build (push) Successful in 11m55s
libakerror CI Build / coverage (push) Successful in 14m16s
libakerror CI Build / mutation_test (push) Successful in 52m8s

This commit is contained in:
2026-08-04 11:22:55 -04:00
parent 0d6517ed5b
commit d00e0cf280
3 changed files with 48 additions and 11 deletions

View File

@@ -380,10 +380,10 @@ akerr_ErrorContext *akerr_next_error()
}
/*
* The wipe returns the slot to the pool, so it and the decrement that triggers
* The reset returns the slot to the pool, so it and the decrement that triggers
* it are one operation under the lock. Otherwise a thread that saw the count
* reach zero could be handed the slot by akerr_next_error() and start writing
* its error into it while the releasing thread was still memsetting it.
* its error into it while the releasing thread was still resetting it.
*/
akerr_ErrorContext *akerr_release_error(akerr_ErrorContext *err)
{
@@ -401,7 +401,13 @@ akerr_ErrorContext *akerr_release_error(akerr_ErrorContext *err)
}
if ( err->refcount == 0 ) {
oldid = err->arrayid;
memset(err, 0x00, sizeof(akerr_ErrorContext));
err->handled = false;
err->status = 0;
err->reported = false;
err->message[0] = '\0';
err->fname[0] = '\0';
err->function[0] = '\0';
err->stacktracebuf[0] = '\0';
err->stacktracebufptr = (char *)&err->stacktracebuf;
err->arrayid = oldid;
remaining = NULL;