swconfig: swlib.c: remove const qualifier for val.s since this is supposed to be...
[openwrt/openwrt.git] / package / network / config / swconfig / src / swlib.c
index 7de3a604e0760010a1a9729dff26e11ed69efd08..f74c093ef4ea4490f69a5d3f8f73ff09a90b7bdb 100644 (file)
@@ -206,7 +206,6 @@ store_val(struct nl_msg *msg, void *arg)
 {
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
        struct switch_val *val = arg;
 {
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
        struct switch_val *val = arg;
-       struct switch_attr *attr = val->attr;
 
        if (!val)
                goto error;
 
        if (!val)
                goto error;
@@ -364,7 +363,7 @@ int swlib_set_attr_string(struct switch_dev *dev, struct switch_attr *a, int por
                val.value.i = atoi(str);
                break;
        case SWITCH_TYPE_STRING:
                val.value.i = atoi(str);
                break;
        case SWITCH_TYPE_STRING:
-               val.value.s = str;
+               val.value.s = (char *)str;
                break;
        case SWITCH_TYPE_PORTS:
                ports = alloca(sizeof(struct switch_port) * dev->ports);
                break;
        case SWITCH_TYPE_PORTS:
                ports = alloca(sizeof(struct switch_port) * dev->ports);
@@ -669,11 +668,7 @@ done:
 static int
 list_switch(struct nl_msg *msg, void *arg)
 {
 static int
 list_switch(struct nl_msg *msg, void *arg)
 {
-       struct swlib_scan_arg *sa = arg;
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
-       struct switch_dev *dev;
-       const char *name;
-       const char *alias;
 
        if (nla_parse(tb, SWITCH_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0)
                goto done;
 
        if (nla_parse(tb, SWITCH_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0)
                goto done;
@@ -729,7 +724,6 @@ struct switch_dev *
 swlib_connect(const char *name)
 {
        struct swlib_scan_arg arg;
 swlib_connect(const char *name)
 {
        struct swlib_scan_arg arg;
-       int err;
 
        if (!refcount) {
                if (swlib_priv_init() < 0)
 
        if (!refcount) {
                if (swlib_priv_init() < 0)
@@ -767,6 +761,8 @@ swlib_free(struct switch_dev *dev)
        swlib_free_attributes(&dev->ops);
        swlib_free_attributes(&dev->port_ops);
        swlib_free_attributes(&dev->vlan_ops);
        swlib_free_attributes(&dev->ops);
        swlib_free_attributes(&dev->port_ops);
        swlib_free_attributes(&dev->vlan_ops);
+       free(dev->name);
+       free(dev->alias);
        free(dev);
 
        if (--refcount == 0)
        free(dev);
 
        if (--refcount == 0)