From: Niraj Kumar Goit Date: Thu, 29 Nov 2018 13:50:30 +0000 (+0530) Subject: g_free 'field' and 'value' if you break out of a while loop. X-Git-Tag: submit/tizen_5.0/20181217.051837~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3db3f8ba0c35d3033020b4896d67f8f50618b9a;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git g_free 'field' and 'value' if you break out of a while loop. g_free 'field' and 'value' if you break out of a while loop using g_variant_iter_loop() Change-Id: I4d76f723d9cedb3772a0f86db97152077cbfe7be Signed-off-by: Niraj Kumar Goit --- diff --git a/src/wifi-eap-config.c b/src/wifi-eap-config.c index 66f67eb..d906d53 100755 --- a/src/wifi-eap-config.c +++ b/src/wifi-eap-config.c @@ -287,6 +287,8 @@ static gboolean __netconfig_create_config(GVariant *fields) cert_file = strrchr(value, '/'); if (cert_file == NULL) { ERR("Failed to get cert file: %s", value); + g_free(field); + g_free(value); goto out; } @@ -297,6 +299,8 @@ static gboolean __netconfig_create_config(GVariant *fields) WIFI_CERT_STORAGEDIR, encoded_ssid); if (dirname == NULL) { ERR("Failed to create dirname"); + g_free(field); + g_free(value); goto out; } if (g_file_test(dirname, G_FILE_TEST_IS_DIR) != TRUE) { @@ -304,6 +308,8 @@ static gboolean __netconfig_create_config(GVariant *fields) S_IXGRP | S_IROTH | S_IXOTH) < 0) { if (errno != EEXIST) { g_free(dirname); + g_free(field); + g_free(value); goto out; } } @@ -314,11 +320,15 @@ static gboolean __netconfig_create_config(GVariant *fields) WIFI_CERT_STORAGEDIR, encoded_ssid, cert_file); if (cert_path == NULL) { ERR("Failed to create cert path"); + g_free(field); + g_free(value); goto out; } if (__netconfig_copy_config(value, cert_path) != TRUE) { ERR("Failed to read cert file %s", value); g_free(cert_path); + g_free(field); + g_free(value); goto out; }