Memory returned by blogmsg_get_string() is volatile, hence use strdup()
to have a permanent copy of the returned string and free it when no
longer needed.
Fixes:
1321c1b ("add basic support for jail network namespaces")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
free(iface->config);
netifd_ubus_remove_interface(iface);
avl_delete(&interfaces.avl, &iface->node.avl);
+ if (iface->jail)
+ free(iface->jail);
+
free(iface);
}
iface->jail = NULL;
if ((cur = tb[IFACE_ATTR_JAIL])) {
- iface->jail = blobmsg_get_string(cur);
+ iface->jail = strdup(blobmsg_get_string(cur));
iface->autostart = false;
}
if_old->device_config = if_new->device_config;
if_old->config_autostart = if_new->config_autostart;
+ if (if_old->jail)
+ free(if_old->jail);
+
if_old->jail = if_new->jail;
if (if_old->jail)
if_old->autostart = false;
const char *name;
const char *ifname;
- const char *jail;
+ char *jail;
int netns_fd;
bool available;