Avoid wiping full error context on release
This commit is contained in:
12
src/error.c
12
src/error.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user