Assign null after g_free in the loop 01/152501/2 accepted/tizen/unified/20170927.181310 submit/tizen/20170927.040141
authorTaesoo Jun <steve.jun@samsung.com>
Tue, 26 Sep 2017 08:30:13 +0000 (17:30 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 26 Sep 2017 09:11:08 +0000 (18:11 +0900)
Change-Id: Icd590c3a8f2b2a161271d659f842779f7b4929ba

src/softap.c

index 3780703d399eced09d43721b2acd042f5a14a86b..54b1ce78791a63ffd45ddecaa99e5bc217e59278 100755 (executable)
@@ -1190,6 +1190,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien
                                interface = g_variant_get_int32(value);
                                if (interface != 3) {
                                        g_free(key);
+                                       key = NULL;
                                        g_variant_unref(value);
                                        break;
                                }
@@ -1216,12 +1217,16 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien
                        }
                }
                g_free(hostname);
+               hostname = NULL;
                g_free(ip);
+               ip = NULL;
                g_free(mac);
+               mac = NULL;
                g_variant_iter_free(inner_iter);
                if (callback((softap_client_h)&client, user_data) == false) {
                        DBG("iteration is stopped\n");
                        g_free(client.hostname);
+                       client.hostname = NULL;
                        g_variant_iter_free(outer_iter);
                        g_variant_unref(station);
                        g_variant_unref(result);
@@ -1229,6 +1234,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien
                        return SOFTAP_ERROR_OPERATION_FAILED;
                }
                g_free(client.hostname);
+               client.hostname = NULL;
        }
        g_variant_iter_free(outer_iter);
        g_variant_unref(station);