Skip to content
Snippets Groups Projects
Commit 0f009d03 authored by blogic's avatar blogic
Browse files

swconfig: swlib.c: free portmaps in swlib_free()


Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46231 3c298f89-4303-0410-b956-a3cf2f4a3e73
parent d649768a
No related branches found
No related tags found
No related merge requests found
...@@ -755,12 +755,26 @@ swlib_free_attributes(struct switch_attr **head) ...@@ -755,12 +755,26 @@ swlib_free_attributes(struct switch_attr **head)
*head = NULL; *head = NULL;
} }
static void
swlib_free_port_map(struct switch_dev *dev)
{
int i;
if (!dev || !dev->maps)
return;
for (i = 0; i < dev->ports; i++)
free(dev->maps[i].segment);
free(dev->maps);
}
void void
swlib_free(struct switch_dev *dev) swlib_free(struct switch_dev *dev)
{ {
swlib_free_attributes(&dev->ops); swlib_free_attributes(&dev->ops);
swlib_free_attributes(&dev->port_ops); swlib_free_attributes(&dev->port_ops);
swlib_free_attributes(&dev->vlan_ops); swlib_free_attributes(&dev->vlan_ops);
swlib_free_port_map(dev);
free(dev->name); free(dev->name);
free(dev->alias); free(dev->alias);
free(dev); free(dev);
......
...@@ -158,7 +158,7 @@ struct switch_port { ...@@ -158,7 +158,7 @@ struct switch_port {
struct switch_portmap { struct switch_portmap {
unsigned int virt; unsigned int virt;
const char *segment; char *segment;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment