From 0f5dd3bcd556ee3b4e871fec3bbdfca285b7aeb5 Mon Sep 17 00:00:00 2001 From: jusung Date: Wed, 8 Dec 2021 11:22:03 +0900 Subject: [PATCH] Fix static issues - USE_AFTER_FREE - CHECKED_RETURN Change-Id: I00fc87db5191dc250b23d9fb6f59c855707f2137 Signed-off-by: jusung --- backend/sqlite.c | 8 +++++++- daemon/cynara.c | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/sqlite.c b/backend/sqlite.c index c7bf8b6..a8e029d 100644 --- a/backend/sqlite.c +++ b/backend/sqlite.c @@ -744,8 +744,14 @@ static int check_table(sqlite3 *db) static int check_owner(const char *dbpath) { struct stat info; + int ret; + + ret = stat(dbpath, &info); + if (ret < 0) { + bxt_err("Failed to get file(%s) status. errno(%d)", dbpath, errno); + return BUXTON_ERROR_IO_ERROR; + } - stat(dbpath, &info); if (info.st_uid != getuid()) { bxt_err("invalid owner [%d : %d]", getuid(), info.st_uid); return BUXTON_ERROR_IO_ERROR; diff --git a/daemon/cynara.c b/daemon/cynara.c index 89bd6e3..c7ddd46 100644 --- a/daemon/cynara.c +++ b/daemon/cynara.c @@ -86,6 +86,8 @@ static void free_cb(gpointer data) cyn_cb->user_data); } + bxt_info("Cynara: free %p", cyn_cb); + free(cyn_cb->label); free(cyn_cb->sess); free(cyn_cb->uid); @@ -93,7 +95,6 @@ static void free_cb(gpointer data) free(cyn_cb->key); free(cyn_cb); - bxt_info("Cynara: free %p", cyn_cb); } static gboolean proc_cb(gint fd, GIOCondition cond, gpointer data) -- 2.7.4