Fix possible db handle leak 10/209910/3
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 12 Jul 2019 08:07:28 +0000 (17:07 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 16 Jul 2019 10:38:35 +0000 (10:38 +0000)
sqlite3_open_v2 could return valid connection even if an error occurs,
according to the document so try to close the connection
even if return value indicates that it has failed.

Change-Id: Ia6fa2975230ea6950e0523ab461061b9941a533f
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
plugin/app2sd/lib/app2sd_client_interface.c

index 5586f41..672d96d 100644 (file)
@@ -669,6 +669,7 @@ char *app2sd_client_usr_get_image_path(const char *pkgid, uid_t uid)
        ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
        if (ret != SQLITE_OK) {
                LOGE("open failed: %s", sqlite3_errmsg(db));
+               sqlite3_close_v2(db);
                return NULL;
        }