diff --git a/src/modules/file_out/file_out.c b/src/modules/file_out/file_out.c index 832420f0276..ad055f1852c 100644 --- a/src/modules/file_out/file_out.c +++ b/src/modules/file_out/file_out.c @@ -250,6 +250,14 @@ static void fo_log_writer_process(int rank) LM_ERR("Failed to flush file with err {%s}\n", strerror(errno)); } + if(log_message.prefix != NULL) { + if(log_message.prefix->s != NULL) { + shm_free(log_message.prefix->s); + } + shm_free(log_message.prefix); + log_message.prefix = NULL; + } + if(log_message.message != NULL) { if(log_message.message->s != NULL) { shm_free(log_message.message->s); diff --git a/src/modules/file_out/types.c b/src/modules/file_out/types.c index e2c93b4f502..6dedfd201e1 100644 --- a/src/modules/file_out/types.c +++ b/src/modules/file_out/types.c @@ -132,7 +132,19 @@ void fo_free_queue(fo_queue_t *q) { fo_log_message_t data; while(fo_dequeue(q, &data) > 0) { - shm_free(data.message); + if(data.prefix != NULL) { + if(data.prefix->s != NULL) { + shm_free(data.prefix->s); + } + shm_free(data.prefix); + } + + if(data.message != NULL) { + if(data.message->s != NULL) { + shm_free(data.message->s); + } + shm_free(data.message); + } } shm_free(q); }