Module: kamailio
Branch: 5.8
Commit: 59ab58551e5895b710893985d0072c8c510c672c
URL:
https://github.com/kamailio/kamailio/commit/59ab58551e5895b710893985d0072c8…
Author: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Committer: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Date: 2024-02-27T14:25:32Z
file_out: Fix leaks
(cherry picked from commit 8af509ae280b2ef155f1946acac5a7d977bb5c14)
---
Modified: src/modules/file_out/file_out.c
Modified: src/modules/file_out/types.c
---
Diff:
https://github.com/kamailio/kamailio/commit/59ab58551e5895b710893985d0072c8…
Patch:
https://github.com/kamailio/kamailio/commit/59ab58551e5895b710893985d0072c8…
---
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);
}