Fix static issues 16/267616/1
authorjusung <jusung07.son@samsung.com>
Wed, 8 Dec 2021 02:22:03 +0000 (11:22 +0900)
committerjusung <jusung07.son@samsung.com>
Wed, 8 Dec 2021 02:22:03 +0000 (11:22 +0900)
 - USE_AFTER_FREE
 - CHECKED_RETURN

Change-Id: I00fc87db5191dc250b23d9fb6f59c855707f2137
Signed-off-by: jusung <jusung07.son@samsung.com>
backend/sqlite.c
daemon/cynara.c

index c7bf8b6..a8e029d 100644 (file)
@@ -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;
index 89bd6e3..c7ddd46 100644 (file)
@@ -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)