Fix dbus method return value #2
[platform/core/connectivity/net-config.git] / src / wifi-key-encryption.c
index 9091ddb..cf40a8a 100755 (executable)
@@ -205,6 +205,7 @@ gchar* _netconfig_encrypt_passphrase(const gchar *passphrase)
                        g_free(origin_value));
 
        if (__netconfig_set_param_list_aes_gcm(param) == NULL) {
+               ckmc_param_list_free(param);
                g_free(origin_value);
                return NULL;
        }
@@ -261,6 +262,7 @@ static gchar* _netconfig_decrypt_passphrase(const gchar *enc_data)
                        g_free(ehexstr));
 
        if (__netconfig_set_param_list_aes_gcm(param) == NULL) {
+               ckmc_param_list_free(param);
                g_free(ehexstr);
                return NULL;
        }
@@ -306,7 +308,7 @@ gboolean handle_encrypt_passphrase(Wifi *wifi, GDBusMethodInvocation *context, c
        if ((wifi == NULL) || (passphrase == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        enc_data = _netconfig_encrypt_passphrase(passphrase);
@@ -314,7 +316,7 @@ gboolean handle_encrypt_passphrase(Wifi *wifi, GDBusMethodInvocation *context, c
        if (!enc_data) {
                ERR("Failed to encrypt the passphrase");
                netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
-               return FALSE;
+               return TRUE;
        }
 
        wifi_complete_encrypt_passphrase(wifi, context, enc_data);
@@ -330,7 +332,7 @@ gboolean handle_decrypt_passphrase(Wifi *wifi, GDBusMethodInvocation *context, c
        if ((wifi == NULL) || (enc_data == NULL)) {
                ERR("Invalid parameter");
                netconfig_error_invalid_parameter(context);
-               return FALSE;
+               return TRUE;
        }
 
        passphrase = _netconfig_decrypt_passphrase(enc_data);
@@ -338,7 +340,7 @@ gboolean handle_decrypt_passphrase(Wifi *wifi, GDBusMethodInvocation *context, c
        if (!passphrase) {
                ERR("Failed to decrypt the passphrase");
                netconfig_error_dbus_method_return(context, NETCONFIG_ERROR_INTERNAL, "OperationFailed");
-               return FALSE;
+               return TRUE;
        }
 
        wifi_complete_decrypt_passphrase(wifi, context, passphrase);