1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-17 01:12:23 +02:00

Various MemContext callback improvements.

Rename memContextCallback() to memContextCallbackSet() to be more consistent with other parts of the code.

Free all context memory when an exception is thrown from a callback.  Previously only the child contexts would be freed and this resulted in some allocations being lost.  In practice this is probably not a big deal since the process will likely terminate shortly, but there may well be cases where that is not true.
This commit is contained in:
David Steele
2019-05-03 18:09:58 -04:00
parent 4a20d44c6b
commit 7ae96949f1
16 changed files with 60 additions and 29 deletions

View File

@ -110,7 +110,7 @@ protocolClientNew(const String *name, const String *service, IoRead *read, IoWri
protocolClientNoOp(this);
// Set a callback to shutdown the protocol
memContextCallback(this->memContext, (MemContextCallback)protocolClientFree, this);
memContextCallbackSet(this->memContext, (MemContextCallback)protocolClientFree, this);
}
MEM_CONTEXT_NEW_END();