Module: kamailio Branch: 5.8 Commit: d6cd0859158a8013e998ec779e956a550b493934 URL: https://github.com/kamailio/kamailio/commit/d6cd0859158a8013e998ec779e956a55...
Author: Xenofon Karamanos 22965395+xkaraman@users.noreply.github.com Committer: Xenofon Karamanos 22965395+xkaraman@users.noreply.github.com Date: 2024-03-14T16:49:27Z
file_out: Fix var position and initialize
(cherry picked from commit e36b2232e9b097794845659f71543bc57ef58a35)
---
Modified: src/modules/file_out/file_out.c
---
Diff: https://github.com/kamailio/kamailio/commit/d6cd0859158a8013e998ec779e956a55... Patch: https://github.com/kamailio/kamailio/commit/d6cd0859158a8013e998ec779e956a55...
---
diff --git a/src/modules/file_out/file_out.c b/src/modules/file_out/file_out.c index ad055f1852c..549eaa6e48f 100644 --- a/src/modules/file_out/file_out.c +++ b/src/modules/file_out/file_out.c @@ -545,7 +545,10 @@ static int fo_get_full_path(const int index, char *full_path) static int fo_write_to_file(sip_msg_t *msg, char *index, char *log_message) { int result, file_index; - str fo_prefix_str, fo_prefix_val; + str fo_prefix_str = str_init(""); + str fo_prefix_val = str_init(""); + str value = str_init(""); + fo_log_message_t logMessage = {0, 0, 0};
if(index == NULL || log_message == NULL) { LM_ERR("filename or log_messsage is NULL\n"); @@ -558,7 +561,6 @@ static int fo_write_to_file(sip_msg_t *msg, char *index, char *log_message) return -1; }
- str value = str_init(""); result = get_str_fparam(&value, msg, (fparam_t *)log_message); if(result < 0) { LM_ERR("Failed to get string from param 1: %d\n", result); @@ -576,7 +578,6 @@ static int fo_write_to_file(sip_msg_t *msg, char *index, char *log_message) }
/* Add the logging string to the global gueue */ - fo_log_message_t logMessage = {0, 0, 0}; logMessage.prefix = &fo_prefix_val; logMessage.message = &value; logMessage.dest_file = file_index;