From: Seonah Moon Date: Tue, 3 Dec 2019 09:25:29 +0000 (+0900) Subject: fix memory leak and wrong type X-Git-Tag: submit/tizen/20191205.103938^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9c8cece1e5422d43b5c2581d82057b46b46bcfd;p=platform%2Fcore%2Fapi%2Fsoftap.git fix memory leak and wrong type - g_variant_iter_loop() doesn't need to free key and value - wifi ap type has been changed since p2p type was added Change-Id: I184f6ec788c7b8558fcb02794407fb49f9046957 --- diff --git a/src/softap.c b/src/softap.c index 0d5a9ef..11e16cc 100755 --- a/src/softap.c +++ b/src/softap.c @@ -1219,7 +1219,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) { if (g_strcmp0(key, "Type") == 0) { interface = g_variant_get_int32(value); - if (interface != 3) { + if (interface != 4) { g_free(key); key = NULL; g_variant_unref(value); @@ -1236,7 +1236,7 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien g_strlcpy(client.mac, mac, sizeof(client.mac)); } else if (g_strcmp0(key, "Name") == 0) { g_variant_get(value, "s", &hostname); - SDBG("hsotname is %s\n", hostname); + SDBG("hostname is %s\n", hostname); if (hostname) client.hostname = g_strdup(hostname); } else if (g_strcmp0(key, "Time") == 0) { @@ -1259,7 +1259,6 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien g_free(client.hostname); client.hostname = NULL; g_variant_iter_free(outer_iter); - g_variant_unref(station); g_variant_unref(result); DBG("-\n"); return SOFTAP_ERROR_OPERATION_FAILED; @@ -1269,7 +1268,6 @@ API int softap_foreach_connected_clients(softap_h softap, softap_connected_clien //LCOV_EXCL_STOP } g_variant_iter_free(outer_iter); - g_variant_unref(station); g_variant_unref(result); DBG("-\n"); return SOFTAP_ERROR_NONE; diff --git a/test/softap_test.c b/test/softap_test.c index 4db27b4..4699caf 100755 --- a/test/softap_test.c +++ b/test/softap_test.c @@ -179,7 +179,7 @@ static bool __clients_foreach_cb(softap_client_h client, void *data) g_print("\tIP Address %s\n", ip_address); g_print("\tMAC Address : %s\n", mac_address); g_print("\tHostname : %s\n", hostname); - g_print("\tTime stamp : %04d-%02d-%02d %02d:%02d:%02d", + g_print("\tTime stamp : %04d-%02d-%02d %02d:%02d:%02d\n", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);