Module: kamailio
Branch: master
Commit: 8af509ae280b2ef155f1946acac5a7d977bb5c14
URL:
https://github.com/kamailio/kamailio/commit/8af509ae280b2ef155f1946acac5a7d…
Author: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Committer: Xenofon Karamanos <22965395+xkaraman(a)users.noreply.github.com>
Date: 2024-02-27T15:18:57+02:00
file_out: Fix leaks
---
Modified: src/modules/file_out/file_out.c
Modified: src/modules/file_out/types.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8af509ae280b2ef155f1946acac5a7d…
Patch:
https://github.com/kamailio/kamailio/commit/8af509ae280b2ef155f1946acac5a7d…
---
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);
}