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

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

SVN-Revision: 46231
This commit is contained in:
John Crispin 2015-07-07 13:46:05 +00:00
parent 2b9bdf4d6f
commit 294907aa3a
2 changed files with 15 additions and 1 deletions

View File

@ -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);

View File

@ -158,7 +158,7 @@ struct switch_port {
struct switch_portmap { struct switch_portmap {
unsigned int virt; unsigned int virt;
const char *segment; char *segment;
}; };
/** /**