param variable that is on a floating state should be deallocated if it is
not used.
Change-Id: I25da4f7f63a588f5190f3b7741bddb67304c6c78
Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
GDBusConnection *conn = NULL;
GVariant * _reply = NULL;
GError *err = NULL;
GDBusConnection *conn = NULL;
GVariant * _reply = NULL;
GError *err = NULL;
if (!method || !param) {
LOGE("invalid parameter");
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,
_reply = g_dbus_connection_call_sync(conn, PA_BUS_NAME,
PA_TONE_PLAYER_OBJECT_PATH,
g_object_unref(conn);
if (!_reply) {
g_object_unref(conn);
if (!_reply) {
LOGE("g_dbus_connection_call_sync() method(%s), err-msg(%s)", method, err->message);
ret = _convert_dbus_error(err->message);
g_error_free(err);
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;
g_variant_unref(_reply);
return TONE_PLAYER_ERROR_NONE;
+
+error:
+ if (param)
+ g_variant_unref(param);
+
+ return ret;