static int __esd_cion_get_uuid(sqlite3 *db, const char *appid, char **uuid) {
int ret = -1;
char *query;
- sqlite3_stmt *stmt;
+ sqlite3_stmt *stmt = NULL;
query = sqlite3_mprintf("SELECT uuid FROM cion_uuid "
"WHERE appid = %Q", appid);
static int __esd_cion_set_uuid(sqlite3 *db, const char *appid, const char *uuid) {
int ret = -1;
char *query;
- sqlite3_stmt *stmt;
+ sqlite3_stmt *stmt = NULL;
query = sqlite3_mprintf("INSERT INTO cion_uuid (appid, uuid) "
"VALUES (%Q, %Q) ", appid, uuid);
sqlite3 *db;
char *query = NULL;
sqlite3_stmt *stmt = NULL;
- char *_uuid;
+ char *_uuid = NULL;
db = esd_cion_db_open();
if (!db) {
return -1;
}
- if (__esd_cion_get_uuid(db, appid, &_uuid) == 0) {
- free(_uuid);
- } else {
+ if (__esd_cion_get_uuid(db, appid, &_uuid) != 0) {
_uuid = (char*)__esd_cion_generate_uuid();
ret = __esd_cion_set_uuid(db, appid, _uuid);
- if (ret != 0) {
- free(_uuid);
+ if (ret != 0)
goto out;
- }
- _E("set uuid generate");
}
query = sqlite3_mprintf("INSERT INTO cion_display_name "
ret = 0;
out:
+ free(_uuid);
sqlite3_free(query);
sqlite3_finalize(stmt);
esd_cion_db_close(&db);
int ret = -1;
sqlite3 *db;
char *query = NULL;
- const char *display_name = NULL;
+ const char *display_name = "";
sqlite3_stmt *stmt = NULL;
sqlite3_stmt *select_stmt = NULL;
if (ret != SQLITE_OK)
goto out;
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_OK && ret != SQLITE_DONE)
+ goto out;
+
+ sqlite3_free(query);
query = sqlite3_mprintf("SELECT display_name FROM cion_display_name "
"WHERE appid = %Q AND service_name = %Q", appid, service_name);
if (query == NULL)
if (ret != SQLITE_OK)
goto out;
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_OK && ret != SQLITE_DONE)
- goto out;
-
ret = sqlite3_step(select_stmt);
if (ret == SQLITE_ROW) {
ret = 0;
char *display_name = (char*)sqlite3_column_text(stmt, 2);
if (display_name)
cion_info->display_name = strdup(display_name);
+ else
+ cion_info->display_name = strdup("");
_D("get list : [%s:%s:%s]",
cion_info->service_name, cion_info->appid, cion_info->display_name);
if (fd < 0)
return ES_R_ERROR;
- ret = read(fd, app_id, sizeof(app_id) - 1);
+ ret = read(fd, app_id, buf_size - 1);
close(fd);
if (ret <= 0)
NULL,
NULL);
- if (boot_id == 0) {
+ if (boot_id == 0)
_E("g_dbus_connection_signal_subscribe() is failed.");
- g_object_unref(connection);
- }
user_boot_id = g_dbus_connection_signal_subscribe(connection,
NULL,
NULL,
NULL);
- if (user_boot_id == 0) {
+ if (user_boot_id == 0)
_E("g_dbus_connection_signal_subscribe() is failed.");
- g_object_unref(connection);
- }
}
static void __esd_on_name_acquired(GDBusConnection *connection,