Commit 7b70b2fd authored by Alex Oprea's avatar Alex Oprea

free the memory before reassigning the pointer

parent 6cd8c270
......@@ -237,6 +237,11 @@ void catv_monitor_init(struct server_ctx *s_ctx)
void catv_monitor_set_socket(char *socket_name)
{
if (socket_name)
ubus_socket = strdup(socket_name);
if (!socket_name)
return;
if (ubus_socket) {
free(ubus_socket);
ubus_socket = NULL;
}
ubus_socket = strdup(socket_name);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment