[Non-ACR]fixing memmory leak fix for account_id_list 45/196945/4 accepted/tizen/unified/20190109.060058 submit/tizen/20190108.110011
authorAbhishek Vijay <abhishek.v@samsung.com>
Tue, 8 Jan 2019 06:18:44 +0000 (11:48 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Tue, 8 Jan 2019 10:33:37 +0000 (16:03 +0530)
Change-Id: Id4e25120565c84fd176af3760ec99664ae740d89
Signed-off-by: Abhishek Vijay <abhishek.v@samsung.com>
common/src/account_db_helper.c

index fd4287ca59743c39bde44264717b32cf7d96696d..975a747f16a1e37e06df4d1c8f8d3c257bafe87b 100644 (file)
@@ -1457,7 +1457,6 @@ int _account_delete_table(sqlite3 *account_db_handle, account_stmt *phstmt,
        if ((_account_db_err_code(account_db_handle) == SQLITE_PERM) && (g_strcmp0(table, ACCOUNT_CUSTOM_TABLE) == 0)) {
                _account_end_transaction(account_db_handle, false);
                ACCOUNT_ERROR("Access failed(%s)", _account_db_err_msg(account_db_handle));
-               g_slist_free_full(account_id_list, g_free);
                return _ACCOUNT_ERROR_PERMISSION_DENIED;
        }
 
@@ -1483,7 +1482,6 @@ int _account_delete_table(sqlite3 *account_db_handle, account_stmt *phstmt,
        if (rc != _ACCOUNT_ERROR_NONE) {
                if (package_name != NULL) {
                        _account_end_transaction(account_db_handle, false);
-                       g_slist_free_full(account_id_list, g_free);
                }
                _ERR("finalize error");
                error_code = rc;
@@ -1609,6 +1607,7 @@ int _account_delete_account_by_package_name(sqlite3 *account_db_handle, const ch
                goto CATCH;
        } else if (error_code != _ACCOUNT_ERROR_NONE) {
                _ERR("account-custom-table deletion failed - error[%d]", error_code);
+               g_slist_free_full(account_id_list, g_free);
                return error_code;
        }
 
@@ -1621,6 +1620,7 @@ int _account_delete_account_by_package_name(sqlite3 *account_db_handle, const ch
                goto CATCH;
        } else if (error_code != _ACCOUNT_ERROR_NONE) {
                _ERR("account-custom-table deletion failed - error[%d]", error_code);
+               g_slist_free_full(account_id_list, g_free);
                return error_code;
        }
 
@@ -1632,6 +1632,7 @@ int _account_delete_account_by_package_name(sqlite3 *account_db_handle, const ch
                goto CATCH;
        } else if (error_code != _ACCOUNT_ERROR_NONE) {
                _ERR("account-custom-table deletion failed - error[%d]", error_code);
+               g_slist_free_full(account_id_list, g_free);
                return error_code;
        }
        is_success = TRUE;
@@ -1647,6 +1648,7 @@ CATCH:
        ret_transaction = _account_end_transaction(account_db_handle, is_success);
 
        if (ret_transaction != _ACCOUNT_ERROR_NONE) {
+               g_slist_free_full(account_id_list, g_free);
                ACCOUNT_ERROR("account_delete:_account_end_transaction fail %d, is_success=%d\n", ret_transaction, is_success);
        } else {
                if (is_success == true) {
@@ -1661,10 +1663,8 @@ CATCH:
                                if (vconf_set_str(VCONFKEY_ACCOUNT_MSG_STR, buf) != 0) {
                                        _ERR("Vconf MSG Str set FAILED !!!!!!\n");;
                                }
-
-                               _ACCOUNT_FREE(p_tmpid);
                        }
-                       g_slist_free(account_id_list);
+                       g_slist_free_full(account_id_list, g_free);
                }
        }