From 7fde2f2ca7452aa999e762d9014408d788a2446e Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Thu, 29 Nov 2018 19:20:30 +0530 Subject: [PATCH] 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 --- src/wifi-eap-config.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } -- 2.34.1