- warning: passing argument 1 of 'gdbm_open' discards 'const' qualifier
from pointer target type
Change-Id: Ib9ec7b0e34027ffccd25f9efd5c6244d238bb791
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
if (db)
return db;
- db = gdbm_open(dbpath, 0, GDBM_WRCREAT, S_IRUSR | S_IWUSR, NULL);
+ nm = strdup(dbpath);
+ if (!nm) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ db = gdbm_open(nm, 0, GDBM_WRCREAT, S_IRUSR | S_IWUSR, NULL);
if (!db) {
bxt_err("Open '%s' failed: %s", dbpath,
gdbm_strerror(gdbm_errno));
errno = EIO;
- return NULL;
- }
-
- nm = strdup(dbpath);
- if (!nm) {
- gdbm_close(db);
- errno = ENOMEM;
+ free(nm);
return NULL;
}