{
int ret;
sqlite3 *db;
- const char *dbpath;
+ char *dbpath;
if (lhs_package_id == NULL || rhs_package_id == NULL ||
compare_result == NULL) {
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
+ free(dbpath);
return PMINFO_R_ERROR;
}
+ free(dbpath);
if (_pkginfo_compare_certinfo(db, lhs_package_id, rhs_package_id,
compare_result)) {
"SELECT package FROM package_app_info WHERE app_id=?";
int ret;
sqlite3 *db;
- const char *dbpath;
+ char *dbpath;
sqlite3_stmt *stmt;
dbpath = getUserPkgParserDBPathUID(uid);
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
+ free(dbpath);
return PMINFO_R_ERROR;
}
+ free(dbpath);
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
{
int ret;
sqlite3 *db;
- const char *dbpath;
+ char *dbpath;
/* open unified global cert db */
dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
+ free(dbpath);
return PMINFO_R_ERROR;
}
+ free(dbpath);
ret = _pkginfo_get_certid(db, pkgid, info->cert_id);
if (ret != PMINFO_R_OK) {
return ret;
}
+ sqlite3_close_v2(db);
+
return PMINFO_R_OK;
}
{
int ret;
sqlite3 *db;
- const char *dbpath;
+ char *dbpath;
pkgmgr_instcertinfo_x *info = (pkgmgr_instcertinfo_x *)handle;
if (pkgid == NULL || handle == NULL) {
return PMINFO_R_EINVAL;
}
+ _check_create_cert_db();
+
/* open unified global cert db */
dbpath = getUserPkgCertDBPathUID(GLOBAL_USER);
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READWRITE, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READWRITE);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
+ free(dbpath);
return PMINFO_R_ERROR;
}
+ free(dbpath);
ret = sqlite3_exec(db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
return PMINFO_R_ERROR;
}
- _check_create_cert_db(db);
-
if (_pkginfo_save_cert_index_info(db, info->cert_info)) {
_LOGE("failed to save cert index info, rollback now");
sqlite3_exec(GET_DB(cert_db), "ROLLBACK", NULL, NULL, NULL);
{
int ret;
sqlite3 *db;
- const char *dbpath;
+ char *dbpath;
if (pkgid == NULL) {
_LOGE("invalid parameter");
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READWRITE, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READWRITE);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
+ free(dbpath);
return PMINFO_R_ERROR;
}
+ free(dbpath);
ret = sqlite3_exec(db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {