diff options
Diffstat (limited to 'src/libmdsclient')
-rw-r--r-- | src/libmdsclient/inbound.c | 7 | ||||
-rw-r--r-- | src/libmdsclient/inbound.h | 3 |
2 files changed, 6 insertions, 4 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; diff --git a/src/libmdsclient/inbound.h b/src/libmdsclient/inbound.h index 197c41b..6080729 100644 --- a/src/libmdsclient/inbound.h +++ b/src/libmdsclient/inbound.h @@ -219,8 +219,7 @@ __attribute__((nonnull, warn_unused_result)) 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 */ |