Clear allocated list items
authorsaerome.kim <saerome.kim@samsung.com>
Fri, 30 Jun 2017 03:54:52 +0000 (12:54 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:35:37 +0000 (11:35 +0900)
- Free allocated structures on destroy.

Signed-off-by: saerome.kim <saerome.kim@samsung.com>
src/mesh-service-interface.c

index 098c6fb..5c21bd8 100644 (file)
@@ -1095,13 +1095,25 @@ static void _meshd_dbus_deinit(mesh_service *service)
        }
 
        /* Clear scan list */
-       g_list_free_full(service->scanned_mesh_network, _on_scan_result_destroy);
+       if (service->scanned_mesh_network)
+               g_list_free_full(service->scanned_mesh_network, _on_scan_result_destroy);
        service->scanned_mesh_network = NULL;
 
        /* Clear connected peers list */
-       g_list_free_full(service->connected_mesh_peers, _on_peer_info_destroy);
+       if (service->connected_mesh_peers)
+               g_list_free_full(service->connected_mesh_peers, _on_peer_info_destroy);
        service->connected_mesh_peers = NULL;
 
+       /* Clear mesh path list */
+       if (service->mpath_list)
+               g_list_free_full(service->mpath_list, _on_mpath_list_destroy);
+       service->mpath_list = NULL;
+
+       /* Clear mesh station list */
+       if (service->station_list)
+               g_list_free_full(service->station_list, _on_station_list_destroy);
+       service->station_list = NULL;
+
        g_free(service->interface_info);
        service->interface_info = NULL;
 }