aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-07-07 13:46:05 +0000
committerJohn Crispin <blogic@openwrt.org>2015-07-07 13:46:05 +0000
commit3f6787dd4bce5b9f7d1b6a6f4f22c6dc5d3c9785 (patch)
tree836b3059c533a8ee9f03a57f77f9810da777c8cf
parent7b458cc164441f85d3a574843bd6f1423f982300 (diff)
downloadmaster-187ad058-3f6787dd4bce5b9f7d1b6a6f4f22c6dc5d3c9785.tar.gz
master-187ad058-3f6787dd4bce5b9f7d1b6a6f4f22c6dc5d3c9785.tar.bz2
master-187ad058-3f6787dd4bce5b9f7d1b6a6f4f22c6dc5d3c9785.zip
swconfig: swlib.c: free portmaps in swlib_free()
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46231 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/network/config/swconfig/src/swlib.c14
-rw-r--r--package/network/config/swconfig/src/swlib.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/package/network/config/swconfig/src/swlib.c b/package/network/config/swconfig/src/swlib.c
index f74c093ef4..d7e570e05d 100644
--- a/package/network/config/swconfig/src/swlib.c
+++ b/package/network/config/swconfig/src/swlib.c
@@ -755,12 +755,26 @@ swlib_free_attributes(struct switch_attr **head)
*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
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_port_map(dev);
free(dev->name);
free(dev->alias);
free(dev);
diff --git a/package/network/config/swconfig/src/swlib.h b/package/network/config/swconfig/src/swlib.h
index 28bdd7f7cb..2b42c14760 100644
--- a/package/network/config/swconfig/src/swlib.h
+++ b/package/network/config/swconfig/src/swlib.h
@@ -158,7 +158,7 @@ struct switch_port {
struct switch_portmap {
unsigned int virt;
- const char *segment;
+ char *segment;
};
/**