return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
-void __finalize_db(sqlite3 * db, sqlite3_stmt * stmt)
+void __finalize_db(sqlite3 * db, sqlite3_stmt * stmt, char* sql)
{
if (stmt != NULL)
sqlite3_finalize(stmt);
if (db != NULL)
sqlite3_close(db);
+
+ if (sql != NULL)
+ sqlite3_free(sql);
}
int __make_privilege_list_str(GList *privilege_list, char** privilege_list_str)
char* temp_privilege_list_str = NULL;
for (l = privilege_list; l != NULL; l = l->next) {
char *privilege_name = (char *)l->data;
- if (temp_privilege_list_str == NULL) {
+ if (temp_privilege_list_str == NULL)
temp_privilege_list_str = sqlite3_mprintf("'%q'", privilege_name);
- } else {
+ else
temp_privilege_list_str = sqlite3_mprintf("%s, '%q'", temp_privilege_list_str, privilege_name);
- }
}
*privilege_list_str = temp_privilege_list_str;
return 0;
LOGD("check black list with uid = %d, package_type = %d, privilege_list = %s", uid, package_type, privilege_list_str);
char *sql = sqlite3_mprintf("select distinct privilege_name from black_list where privilege_name in(%s)and uid=%d and package_type=%d", privilege_list_str, uid, package_type);
sqlite3_free(privilege_list_str);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
if (count > 0)
LOGE("Privilege list contains banned privileges!");
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return count;
}
char *sql = sqlite3_mprintf("select privilege_name, privilege_level_id, %s, api_version_issued, api_version_expired from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d", changed_to_version, PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, package_type);
free(changed_to_version);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
+
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
privilege_info_db_row_s *privilege_info_db_row = (privilege_info_db_row_s *)malloc(sizeof(privilege_info_db_row_s));
- TryReturn(privilege_info_db_row != NULL, free(privilege_info_db_row), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_info_db_row's malloc is failed.");
+ TryReturn(privilege_info_db_row != NULL, free(privilege_info_db_row); __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_info_db_row's malloc is failed.");
privilege_info_db_row->profile = NULL;
privilege_info_db_row->package_type = NULL;
privilege_info_db_row->privilege_name = strdup((char *)sqlite3_column_text(stmt, 0));
TryReturn(privilege_info_db_row->privilege_name != NULL, free(privilege_info_db_row->privilege_name);
- free(privilege_info_db_row), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
+ free(privilege_info_db_row);
+ __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
privilege_info_db_row->privilege_level_id = sqlite3_column_int(stmt, 1);
privilege_info_db_row->changed_to = strdup((char *)sqlite3_column_text(stmt, 2));
TryReturn(privilege_info_db_row->changed_to != NULL, free(privilege_info_db_row->privilege_name);
free(privilege_info_db_row->changed_to);
- free(privilege_info_db_row), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] changed_to's strdup is failed.");
+ free(privilege_info_db_row);
+ __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] changed_to's strdup is failed.");
privilege_info_db_row->issued_version = strdup((char *)sqlite3_column_text(stmt, 3));
TryReturn(privilege_info_db_row->issued_version != NULL, free(privilege_info_db_row->privilege_name);
free(privilege_info_db_row->changed_to);
free(privilege_info_db_row->issued_version);
- free(privilege_info_db_row), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] issued_version's strdup is failed.");
+ free(privilege_info_db_row);
+ __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] issued_version's strdup is failed.");
privilege_info_db_row->expired_version = strdup((char *)sqlite3_column_text(stmt, 4));
TryReturn(privilege_info_db_row->expired_version != NULL, free(privilege_info_db_row->privilege_name);
free(privilege_info_db_row->changed_to);
free(privilege_info_db_row->issued_version);
free(privilege_info_db_row->expired_version);
- free(privilege_info_db_row), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] expired_version's strdup is failed.");
+ free(privilege_info_db_row);
+ __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] expired_version's strdup is failed.");
temp_privilege_list = g_list_append(temp_privilege_list, privilege_info_db_row);
}
*privilege_list = temp_privilege_list;
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
char *privilege_list_str = NULL;
ret = __make_privilege_list_str(privilege_list, &privilege_list_str);
- TryReturn(ret == 0 && privilege_list_str != NULL, , PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] making privilege_list_str for where in query is failed.");
+ TryReturn(ret == 0 && privilege_list_str != NULL, sqlite3_close(db), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] making privilege_list_str for where in query is failed.");
char *sql = sqlite3_mprintf("select distinct mapped_privilege_name from privilege_mapping where privilege_name in(%s)and(profile_id=%d or profile_id=%d)and from_api_version<=%Q and to_api_version>%Q", privilege_list_str, PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, api_version, api_version);
sqlite3_free(privilege_list_str);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
*mapped_privilege_list = temp_privilege_list;
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
} else {
sql = sqlite3_mprintf("select privilege_display from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d and privilege_name=%Q and api_version_issued<=%Q and api_version_expired>%Q", PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, package_type, privilege_name, api_version, api_version);
}
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
LOGD("privilege_display = %s", (char *)sqlite3_column_text(stmt, 0));
*privilege_display = strdup((char *)sqlite3_column_text(stmt, 0));
- TryReturn(*privilege_display != NULL, , PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
- __finalize_db(db, stmt);
+ TryReturn(*privilege_display != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
+
return PRIVILEGE_DB_NO_EXIST_RESULT;
}
sql = sqlite3_mprintf("select privilege_description from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d and privilege_name=%Q", PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, package_type, privilege_name);
else
sql = sqlite3_mprintf("select privilege_description from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d and privilege_name=%Q and api_version_issued<=%Q and api_version_expired>%Q", PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, package_type, privilege_name, api_version, api_version);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
LOGD("privilege_description = %s", (char *)sqlite3_column_text(stmt, 0));
*privilege_description = strdup((char *)sqlite3_column_text(stmt, 0));
- TryReturn(*privilege_description != NULL, , PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
+ TryReturn(*privilege_description != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY, "[PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY] privilege_name's strdup is failed.");
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
+
return PRIVILEGE_DB_NO_EXIST_RESULT;
}
char *sql = sqlite3_mprintf("select privilege_group_id from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d and privilege_name=%Q and api_version_issued<=%Q",
PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, package_type, privilege_name, api_version, api_version);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
*privilege_group_number = (int)sqlite3_column_int(stmt, 0);
LOGD("privilege_group_number = %d", *privilege_group_number);
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
+
return PRIVILEGE_DB_NO_EXIST_RESULT;
}
-int __privilege_db_manager_is_privacy(const char* privilege)
+int privilege_db_manager_is(char type, const char* privilege)
{
sqlite3 *db = NULL;
sqlite3_stmt *stmt = NULL;
- int is_privacy = 0;
+ int res = 0;
int ret = __initialize_db('i', &db, PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE);
TryReturn(ret == PRIVILEGE_DB_MANAGER_ERR_NONE, , ret, "[PRIVILEGE_DB_MANAGER] DB INITIALIZE FAIL");
- char *sql = sqlite3_mprintf("select is_privacy from privilege_info where(profile_id=%d or profile_id=%d)and package_type_id=%d and privilege_name=%Q",
- PRIVILEGE_DB_MANAGER_PROFILE_TYPE_COMMON, g_privilege_db_manager_profile_type, PRIVILEGE_DB_MANAGER_PACKAGE_TYPE_CORE, privilege);
+ char *sql = sqlite3_mprintf("select * from valid_privilege_info where privilege_name=%Q", privilege);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
- TryReturn (ret == SQLITE_OK, sqlite3_close(db), -PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
+ TryReturn(ret == SQLITE_OK, __finalize_db(db, stmt, sql), -PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
ret = sqlite3_step(stmt);
if (ret == SQLITE_ROW) {
- is_privacy = sqlite3_column_int(stmt, 0);
- ret = PRIVILEGE_DB_MANAGER_ERR_NONE;
+ LOGD("privilege: %s, is-privacy : %d, is-internal : %d", (char*)sqlite3_column_text(stmt, 0), sqlite3_column_int(stmt, 1), sqlite3_column_int(stmt, 2));
+ switch (type) {
+ case 'v':
+ res = 1;
+ break;
+ case 'p':
+ res = sqlite3_column_int(stmt, 1);
+ break;
+ case 'i':
+ res = sqlite3_column_int(stmt, 2);
+ break;
+ default:
+ LOGE("Undefined type for privilege_db_manager_is()");
+ return PRIVILEGE_DB_MANAGER_ERR_INVALID_TYPE;
+ }
} else if (ret == SQLITE_DONE) {
- LOGD("[PRIVILEGE_DB_MANAGER] NO DATA TO READ. ret = %d", ret);
- ret = PRIVILEGE_DB_MANAGER_ERR_NONE;
+ LOGD("[PRIVILEGE_DB_MANAGER] NO DATA TO READ. %s is invalid privilege. ret = %d", privilege, ret);
+ } else {
+ res = -1;
}
- __finalize_db(db, stmt);
- sqlite3_free(sql);
- if (ret > 0)
+ __finalize_db(db, stmt, sql);
+
+ if (res < 0)
return -ret;
else
- return is_privacy;
+ return res;
}
int __privilege_db_manager_get_privacy_list(GList **privacy_list)
return ret;
char *sql = sqlite3_mprintf("select DISTINCT privacy_group from privilege_info where is_privacy=1 order by privacy_group");
- ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
*privacy_list = temp_privacy_list;
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
return ret;
char *sql = sqlite3_mprintf("select distinct privilege_name from privilege_info where is_privacy=1 and privacy_group=%Q", privacy);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
*privilege_list = temp_privilege_list;
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
return ret;
LOGD("Get privilege_name from black_list where uid = %d, package_type = %d", uid, package_type);
char* sql = sqlite3_mprintf("select privilege_name from black_list where uid=%d and package_type=%d", uid, package_type);
+ TryReturn(sql != NULL, __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
*privilege_list = temp_privilege_list;
- __finalize_db(db, stmt);
- sqlite3_free(sql);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
char *privilege_name = (char *)l->data;
LOGD("insert uid = %d, package_type = %d, privilege_name = %s", uid, package_type, privilege_name);
char* sql = sqlite3_mprintf("insert or ignore into black_list (uid, package_type, privilege_name) values (%d, %d, %Q)", uid, package_type, privilege_name);
+ TryReturn(sql != NULL, sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL); __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_DONE) {
__get_db_error(ret);
sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, sql);
return ret;
}
sqlite3_free(sql);
}
sqlite3_exec(db, "COMMIT TRANSACTION", NULL, NULL, NULL);
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, NULL);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}
char *privilege_name = (char *)l->data;
LOGD("delete from black_list where uid = %d, package_type = %d, privilege_name = %s", uid, package_type, privilege_name);
char* sql = sqlite3_mprintf("delete from black_list where uid=%d and package_type=%d and privilege_name=%Q", uid, package_type, privilege_name);
+ TryReturn(sql != NULL, sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL); __finalize_db(db, stmt, sql), PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY, "[DB_FAIL] sqlite3_mprintf failed");
ret = sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("[DB_FAIL] fail to prepare database : %s", sqlite3_errmsg(db));
sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- sqlite3_close(db);
+ __finalize_db(db, stmt, sql);
return PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_DONE) {
__get_db_error(ret);
sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, sql);
return ret;
}
sqlite3_free(sql);
}
sqlite3_exec(db, "COMMIT TRANSACTION", NULL, NULL, NULL);
- __finalize_db(db, stmt);
+ __finalize_db(db, stmt, NULL);
return PRIVILEGE_DB_MANAGER_ERR_NONE;
}