From: jiseob.jang Date: Mon, 23 May 2016 12:29:18 +0000 (+0900) Subject: fix memory leak. X-Git-Tag: accepted/tizen/common/20160530.132225^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51fe4aa9f816b7f320425b9331f00d3504106f7e;p=platform%2Fcore%2Fapi%2Flibaccount-service.git fix memory leak. Change-Id: I22c363e668d027305d14ad8d142b63c2a4e3a841 Signed-off-by: jiseob.jang --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 56a9003..8c791dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,6 @@ SET(EXEC_PREFIX ${_prefix}) #SET(LIBDIR "\${prefix}/lib") #SET(INCLUDEDIR "\${prefix}/include ") SET(VERSION_MAJOR 0) -SET(VERSION "${VERSION_MAJOR}.4.1") +SET(VERSION "${VERSION_MAJOR}.4.2") ADD_SUBDIRECTORY(src) diff --git a/packaging/libaccount-service.spec b/packaging/libaccount-service.spec index e981d54..44a5161 100644 --- a/packaging/libaccount-service.spec +++ b/packaging/libaccount-service.spec @@ -1,7 +1,7 @@ Name: libaccount-service Summary: Account DB library -Version: 0.4.1 +Version: 0.4.2 Release: 1 Group: Social & Content/API License: Apache-2.0 diff --git a/src/account.c b/src/account.c index 4d0da30..58ec184 100644 --- a/src/account.c +++ b/src/account.c @@ -203,6 +203,8 @@ ACCOUNT_API int account_insert_to_db(account_h account, int *account_db_id) _INFO("3. Before account_manager_call_account_add_sync"); bool is_success = account_manager_call_account_add_sync(acc_mgr, account_serialized, (int)getuid(), &db_id, NULL, &error); + g_variant_unref(account_serialized); + ACCOUNT_CATCH_ERROR((is_success != false), {}, _account_get_error_code(is_success, error), "Failed to get dbus."); g_clear_error(&error); @@ -393,6 +395,7 @@ ACCOUNT_API int account_update_to_db_by_id(account_h account, int account_id) _INFO("3. Before account_manager_call_account_update_to_db_by_id_sync"); GVariant *account_serialized = marshal_account((account_s *)account); is_success = account_manager_call_account_update_to_db_by_id_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error); + g_variant_unref(account_serialized); if (!is_success) { error_code = _account_get_error_code(is_success, error); @@ -452,6 +455,7 @@ ACCOUNT_INTERNAL_API int account_update_to_db_by_id_without_permission(account_h _INFO("before call update() : account_id[%d]", account_id); is_success = account_manager_call_account_update_to_db_by_id_ex_sync(acc_mgr, account_serialized, account_id, (int)getuid(), NULL, &error); + g_variant_unref(account_serialized); _INFO("after call update() : is_success=%d", is_success); if (!is_success) { @@ -496,6 +500,7 @@ ACCOUNT_API int account_update_to_db_by_user_name(account_h account, const char GVariant *account_serialized = marshal_account(account_data); is_success = account_manager_call_account_update_to_db_by_user_name_sync(acc_mgr, account_serialized, user_name, package_name, (int)getuid(), NULL, &error); + g_variant_unref(account_serialized); if (!is_success) { error_code = _account_get_error_code(is_success, error); @@ -1401,6 +1406,7 @@ ACCOUNT_API int account_query_account_by_account_id(int account_db_id, account_h _INFO("before unmarshal_account"); account_s *account_data = umarshal_account(account_variant); + g_variant_unref(account_variant); _INFO("after unmarshal_account"); if (account_data == NULL) { @@ -1631,6 +1637,7 @@ ACCOUNT_API int account_query_capability_by_account_id(capability_cb callback, i return error_code; GSList *capability_list = unmarshal_capability_list(capability_list_variant); + g_variant_unref(capability_list_variant); if (capability_list == NULL) return ACCOUNT_ERROR_NO_DATA; @@ -2265,6 +2272,7 @@ ACCOUNT_INTERNAL_API int account_type_insert_to_db(account_type_h account_type, int db_id = -1; GVariant *account_type_serialized = marshal_account_type((account_type_s *)account_type); bool is_success = account_manager_call_account_type_add_sync(acc_mgr, account_type_serialized, (int)getuid(), &db_id, NULL, &error); + g_variant_unref(account_type_serialized); int ret = _account_get_error_code(is_success, error); g_clear_error(&error); @@ -2305,6 +2313,7 @@ ACCOUNT_INTERNAL_API int account_type_update_to_db_by_app_id(const account_type_ } bool is_success = account_manager_call_account_type_update_to_db_by_app_id_sync(acc_mgr, account_type_variant, app_id, (int)getuid(), NULL, &error); + g_variant_unref(account_type_variant); error_code = _account_get_error_code(is_success, error); g_clear_error(&error);