}
scanner = g_malloc0(sizeof(uam_scanner_info_t));
+ if (scanner) {
+ UAM_ERR("Failed to allocate memory");
+ return UAM_ERROR_OUT_OF_MEMORY;
+ }
scanner->name = g_strdup(sender);
scanner->sensors |= sensors;
scanner->timer = g_timeout_add_seconds(detection_period,
stmt = NULL;
FINALIZE(select_version);
UAM_ERR("Failed to prepare \"%s\" query", sql);
+ sqlite3_free(sql);
return rc;
}
FINALIZE(select_version);
sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ sqlite3_free(sql);
FUNC_EXIT;
return error_code;
}
{
FUNC_ENTRY;
char *sql = NULL;
+ int ret = UAM_ERROR_NONE;
sql = sqlite3_mprintf("PRAGMA user_version = '%d';", version);
- retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED);
- sqlite3_free(sql);
- UAM_DBG("Successfully updated database version to %d", version);
+ ret = __uam_db_exec_sql(sql, NULL);
+ if (UAM_ERROR_NONE != ret)
+ UAM_DBG("failed to updated database version to %d", version);
+ else
+ UAM_DBG("Successfully updated database version to %d", version);
+
+ sqlite3_free(sql);
FUNC_EXIT;
- return UAM_ERROR_NONE;
+ return ret;
}
static int __uam_db_upgrade(unsigned int version)
static int __uam_db_set_locking_mode(void)
{
char *sql = NULL;
+ int ret = UAM_ERROR_NONE;
sql = sqlite3_mprintf("PRAGMA locking_mode = NORMAL");
- retv_if(UAM_ERROR_NONE != __uam_db_exec_sql(sql, NULL), UAM_ERROR_DB_FAILED);
+ ret = __uam_db_exec_sql(sql, NULL);
+ if (UAM_ERROR_NONE != ret)
+ ret = UAM_ERROR_DB_FAILED;
+
sqlite3_free(sql);
- return UAM_ERROR_NONE;
+ return ret;
}
static int __uam_db_create_table(const char *table_name)