GDBusConnection *conn = NULL;
GVariant * _reply = NULL;
GError *err = NULL;
+ int ret;
if (!method || !param) {
LOGE("invalid parameter");
- return TONE_PLAYER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ ret = TONE_PLAYER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ goto error;
}
- if (!(conn = __get_dbus_connection()))
- return TONE_PLAYER_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE
+ if (!(conn = __get_dbus_connection())) {
+ ret = TONE_PLAYER_ERROR_INVALID_OPERATION; //LCOV_EXCL_LINE
+ goto error;
+ }
_reply = g_dbus_connection_call_sync(conn, PA_BUS_NAME,
PA_TONE_PLAYER_OBJECT_PATH,
g_object_unref(conn);
if (!_reply) {
- int ret;
-
LOGE("g_dbus_connection_call_sync() method(%s), err-msg(%s)", method, err->message);
ret = _convert_dbus_error(err->message);
g_error_free(err);
g_variant_unref(_reply);
return TONE_PLAYER_ERROR_NONE;
+
+error:
+ if (param)
+ g_variant_unref(param);
+
+ return ret;
}