Skip to content
Snippets Groups Projects
Verified Commit 741ef6aa authored by Suvendhu Hansa's avatar Suvendhu Hansa :speech_balloon: Committed by IOPSYS Dev
Browse files

Fix segfault

parent 7dfe9ae4
No related branches found
No related tags found
1 merge request!36Fix crash
Pipeline #216456 passed
...@@ -117,7 +117,6 @@ static int stunc_get_auth_code(char *data, int data_len, const char *key, char * ...@@ -117,7 +117,6 @@ static int stunc_get_auth_code(char *data, int data_len, const char *key, char *
static int stunc_init(void) static int stunc_init(void)
{ {
int len; int len;
char address[256] = {0};
char *val; char *val;
stunc_uci_init(); stunc_uci_init();
...@@ -129,7 +128,11 @@ static int stunc_init(void) ...@@ -129,7 +128,11 @@ static int stunc_init(void)
val = stunc_uci_get_value("stunc", "stunc", "server_address"); val = stunc_uci_get_value("stunc", "stunc", "server_address");
if (STRLEN(val) == 0) { if (STRLEN(val) == 0) {
char address[256] = {0};
SLOG(INFO, "Server Address not present in the STUN config"); SLOG(INFO, "Server Address not present in the STUN config");
FREE(val);
/* Read from ACS address */ /* Read from ACS address */
get_acs_address(&val); get_acs_address(&val);
if (val == NULL) if (val == NULL)
...@@ -166,13 +169,12 @@ get_addr: ...@@ -166,13 +169,12 @@ get_addr:
snprintf(address, len + 1, "%s", val); snprintf(address, len + 1, "%s", val);
free(tmp); free(tmp);
conf.server_address = strdup(address);
val = address; } else {
conf.server_address = strdup(val);
FREE(val);
} }
conf.server_address = strdup(val);
FREE(val);
val = stunc_uci_get_value("stunc", "stunc", "username"); val = stunc_uci_get_value("stunc", "stunc", "username");
if (STRLEN(val)) if (STRLEN(val))
conf.username = strdup(val); conf.username = strdup(val);
...@@ -273,9 +275,9 @@ static int stunc_start(void) ...@@ -273,9 +275,9 @@ static int stunc_start(void)
static int stunc_finish(void) static int stunc_finish(void)
{ {
free(conf.server_address); FREE(conf.server_address);
free(conf.password); FREE(conf.password);
free(conf.username); FREE(conf.username);
conf.server_address = NULL; conf.server_address = NULL;
conf.username = NULL; conf.username = NULL;
conf.password = NULL; conf.password = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment