diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-09-05 01:30:05 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-09-05 01:30:05 +0200 |
commit | 0d0599f5539fe21a783937c7a529e0b66fb12b99 (patch) | |
tree | f80ab24008bd33de96e44da1bb93c0715d0fb9f1 /src/libmdsclient/inbound.c | |
parent | vrindex (diff) | |
download | mds-0d0599f5539fe21a783937c7a529e0b66fb12b99.tar.gz mds-0d0599f5539fe21a783937c7a529e0b66fb12b99.tar.bz2 mds-0d0599f5539fe21a783937c7a529e0b66fb12b99.tar.xz |
destruction of message spools and pools causes stored objects to be deallocated
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsclient/inbound.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libmdsclient/inbound.c b/src/libmdsclient/inbound.c index e2831a6..9f0254a 100644 --- a/src/libmdsclient/inbound.c +++ b/src/libmdsclient/inbound.c @@ -60,8 +60,7 @@ int libmds_message_initialise(libmds_message_t* restrict this) /** - * Release all resources in a message, should - * be done even if initialisation fails + * Release all resources in a message * * @param this The message */ @@ -577,6 +576,8 @@ void libmds_mspool_destroy(libmds_mspool_t* restrict this) { if (this->messages == NULL) return; + while (this->tail < this->head) + free(this->messages[this->tail++]); sem_destroy(&(this->lock)); sem_destroy(&(this->semaphore)); sem_destroy(&(this->wait_semaphore)); @@ -776,6 +777,8 @@ void libmds_mpool_destroy(libmds_mpool_t* restrict this) { if (this->messages == NULL) return; + while (this->tip--) + free(this->messages[this->tip]); sem_destroy(&(this->lock)); free(this->messages); this->messages = NULL; |