Don't use myself->name in device_disable(), it's already freed.
This commit is contained in:
parent
313de46e70
commit
d00d8dbb9b
1 changed files with 7 additions and 2 deletions
|
@ -44,6 +44,7 @@
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
char *myport;
|
char *myport;
|
||||||
|
static char *myname;
|
||||||
static io_t device_io;
|
static io_t device_io;
|
||||||
devops_t devops;
|
devops_t devops;
|
||||||
bool device_standby = false;
|
bool device_standby = false;
|
||||||
|
@ -715,7 +716,7 @@ void device_enable(void) {
|
||||||
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
|
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
|
||||||
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
|
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
|
||||||
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
|
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
|
||||||
xasprintf(&envp[3], "NAME=%s", myself->name);
|
xasprintf(&envp[3], "NAME=%s", myname);
|
||||||
|
|
||||||
execute_script("tinc-up", envp);
|
execute_script("tinc-up", envp);
|
||||||
|
|
||||||
|
@ -728,7 +729,7 @@ void device_disable(void) {
|
||||||
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
|
xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
|
||||||
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
|
xasprintf(&envp[1], "DEVICE=%s", device ? : "");
|
||||||
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
|
xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
|
||||||
xasprintf(&envp[3], "NAME=%s", myself->name);
|
xasprintf(&envp[3], "NAME=%s", myname);
|
||||||
|
|
||||||
execute_script("tinc-down", envp);
|
execute_script("tinc-down", envp);
|
||||||
|
|
||||||
|
@ -752,6 +753,7 @@ static bool setup_myself(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myname = xstrdup(name);
|
||||||
myself = new_node();
|
myself = new_node();
|
||||||
myself->connection = new_connection();
|
myself->connection = new_connection();
|
||||||
myself->name = name;
|
myself->name = name;
|
||||||
|
@ -1121,5 +1123,8 @@ void close_network_connections(void) {
|
||||||
|
|
||||||
exit_control();
|
exit_control();
|
||||||
|
|
||||||
|
free(myname);
|
||||||
|
myname = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue