Merge "g_free 'field' and 'value' if you break out of a while loop." into tizen
[platform/core/connectivity/net-config.git] / src / wifi-eap-config.c
index 99d406b..48597c9 100755 (executable)
@@ -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;
                                }