Author: blogic
Date: 2015-07-07 15:46:05 +0200 (Tue, 07 Jul 2015)
New Revision: 46231

Modified:
   trunk/package/network/config/swconfig/src/swlib.c
   trunk/package/network/config/swconfig/src/swlib.h
Log:
swconfig: swlib.c: free portmaps in swlib_free()

Signed-off-by: Alexandru Ardelean <[email protected]>

Modified: trunk/package/network/config/swconfig/src/swlib.c
===================================================================
--- trunk/package/network/config/swconfig/src/swlib.c   2015-07-07 13:45:56 UTC 
(rev 46230)
+++ trunk/package/network/config/swconfig/src/swlib.c   2015-07-07 13:46:05 UTC 
(rev 46231)
@@ -755,12 +755,26 @@
        *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);

Modified: trunk/package/network/config/swconfig/src/swlib.h
===================================================================
--- trunk/package/network/config/swconfig/src/swlib.h   2015-07-07 13:45:56 UTC 
(rev 46230)
+++ trunk/package/network/config/swconfig/src/swlib.h   2015-07-07 13:46:05 UTC 
(rev 46231)
@@ -158,7 +158,7 @@
 
 struct switch_portmap {
        unsigned int virt;
-       const char *segment;
+       char *segment;
 };
 
 /**
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to