mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
switch: fix some memory leaks in switch_parse_vlan()
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29936 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user