Free GVariant only if necessary 42/231542/2
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 22 Apr 2020 08:19:47 +0000 (17:19 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 22 Apr 2020 09:15:57 +0000 (18:15 +0900)
- g_dbus_connection_call_sync consumes GVariant argument
  on this situations
  - on succeed
  - on failed with setting GErr
- So, we have to free only if it is failed without setting GErr

Change-Id: I39466f7ac0cddb229bd61ace5f3b9687f80e069f
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/runtime_info_usage.c

index ff04310..64120d2 100644 (file)
@@ -176,7 +176,7 @@ static GVariant *runtime_info_dbus_request_usage_info(runtime_info_usage_type_e
                        *error = RUNTIME_INFO_ERROR_PERMISSION_DENIED;
                else
                        *error = RUNTIME_INFO_ERROR_REMOTE_IO;
-               if (args_in)
+               if (args_in && !err)
                        g_variant_unref(args_in);
                return NULL;
                //LCOV_EXCL_STOP