diff options
-rw-r--r-- | common/src/account_db_helper.c | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/common/src/account_db_helper.c b/common/src/account_db_helper.c index c05fd42..a89a628 100644 --- a/common/src/account_db_helper.c +++ b/common/src/account_db_helper.c @@ -1016,10 +1016,29 @@ int _account_get_represented_appid_from_db(sqlite3 *account_user_db, sqlite3 *ac /* Get app id family which is stored in account database */ _account_get_appid_from_db(&ahandle, &phandle, &package_id, appid, uid, &appid_list); - ACCOUNT_RETURN_VAL((ahandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL")); - ACCOUNT_RETURN_VAL((phandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL")); - ACCOUNT_RETURN_VAL((package_id != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL")); - ACCOUNT_RETURN_VAL((appid_list != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL")); + ACCOUNT_RETURN_VAL((ahandle != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (package_id) free(package_id); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL")); + + ACCOUNT_RETURN_VAL((phandle != NULL), { + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (package_id) free(package_id); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL")); + + ACCOUNT_RETURN_VAL((package_id != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL")); + + ACCOUNT_RETURN_VAL((appid_list != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (package_id) free(package_id); + }, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL")); /* Compare current app id with the stored app id family */ for (iter = appid_list; iter != NULL; iter = g_slist_next(iter)) { @@ -1077,10 +1096,29 @@ int _account_check_appid_group_with_package_name(const char *appid, char *packag /* Get app id family which is stored in account database */ _account_get_appid_from_db(&ahandle, &phandle, &package_id, appid, uid, &appid_list); - ACCOUNT_RETURN_VAL((ahandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL")); - ACCOUNT_RETURN_VAL((phandle != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL")); - ACCOUNT_RETURN_VAL((package_id != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL")); - ACCOUNT_RETURN_VAL((appid_list != NULL), {}, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL")); + ACCOUNT_RETURN_VAL((ahandle != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (package_id) free(package_id); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("appinfo handle is NULL")); + + ACCOUNT_RETURN_VAL((phandle != NULL), { + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (package_id) free(package_id); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("pkginfo handle is NULL")); + + ACCOUNT_RETURN_VAL((package_id != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (appid_list) g_slist_free(appid_list); + }, _ACCOUNT_ERROR_NO_DATA, ("package_id is NULL")); + + ACCOUNT_RETURN_VAL((appid_list != NULL), { + if (phandle) pkgmgrinfo_pkginfo_destroy_pkginfo(phandle); + if (ahandle) pkgmgrinfo_appinfo_destroy_appinfo(ahandle); + if (package_id) free(package_id); + }, _ACCOUNT_ERROR_NO_DATA, ("appid_list is NULL")); /* Compare current app id with the stored app id family */ for (iter = appid_list; iter != NULL; iter = g_slist_next(iter)) { |