Skip to content

Commit 8d371dd

Browse files
authored
Merge pull request #329 from hreinecke/read_config
tree: always allocate config file in nvme_read_config()
2 parents 451b365 + 65c4f64 commit 8d371dd

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/nvme/tree.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,12 @@ int nvme_read_config(nvme_root_t r, const char *config_file)
152152
return err;
153153
}
154154

155+
r->config_file = strdup(config_file);
156+
if (!r->config_file) {
157+
errno = ENOMEM;
158+
return err;
159+
}
155160
err = json_read_config(r, config_file);
156-
if (!err)
157-
r->config_file = strdup(config_file);
158161
/*
159162
* The json configuration file is optional,
160163
* so ignore errors when opening the file.

0 commit comments

Comments
 (0)