diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-10-01 15:03:30 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-10-04 20:10:33 +0200 |
commit | 7be3f5f17ca8972b92c2bda4b6af0c6db51328b6 (patch) | |
tree | 6c600318af73ea17e69fd65348e816634fba988a | |
parent | e80de45c859b1bc1b5e5f63199ea74c210ff8198 (diff) |
wireless: copy the vif section name instead of keeping a reference that might go stale
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | wireless.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -660,7 +660,7 @@ void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *d struct wireless_interface *vif; struct blob_attr *tb[__VIF_ATTR_MAX]; struct blob_attr *cur; - char *name_buf; + char *name_buf, *section_buf; char name[8]; blobmsg_parse(vif_policy, __VIF_ATTR_MAX, tb, blob_data(data), blob_len(data)); @@ -671,11 +671,13 @@ void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *d sprintf(name, "%d", wdev->vif_idx++); - vif = calloc_a(sizeof(*vif), &name_buf, strlen(name) + 1); + vif = calloc_a(sizeof(*vif), + &name_buf, strlen(name) + 1, + §ion_buf, strlen(section) + 1); vif->name = strcpy(name_buf, name); vif->wdev = wdev; vif->config = data; - vif->section = section; + vif->section = strcpy(section_buf, section); vlist_add(&wdev->interfaces, &vif->node, vif->name); } |