X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/47cfa18482a78c1dc5842478b349e6e0f02f9bce..a0ef5265a19750b5d20b48c5233eda666a5c98ad:/package/switch/src/switch-core.c?ds=sidebyside diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c index 2e5395950..79b4e93f0 100644 --- a/package/switch/src/switch-core.c +++ b/package/switch/src/switch-core.c @@ -341,10 +341,9 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf) switch_vlan_config *c; int j, u, p, s; - c = kmalloc(sizeof(switch_vlan_config), GFP_KERNEL); + c = kzalloc(sizeof(switch_vlan_config), GFP_KERNEL); if (!c) return NULL; - memset(c, 0, sizeof(switch_vlan_config)); while (isspace(*buf)) buf++; j = 0; @@ -382,7 +381,10 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf) while (isspace(*buf)) buf++; } - if (*buf != 0) return NULL; + if (*buf != 0) { + kfree(c); + return NULL; + } c->port &= (1 << driver->ports) - 1; c->untag &= (1 << driver->ports) - 1; @@ -394,7 +396,6 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf) int switch_device_registered (char* device) { struct list_head *pos; - switch_driver *new; list_for_each(pos, &drivers.list) { if (strcmp(list_entry(pos, switch_driver, list)->interface, device) == 0) {