forked from external/yambar
config: don’t ignore asprintf() return value
This commit is contained in:
parent
8e4d7f04e4
commit
f923261fec
1 changed files with 4 additions and 2 deletions
6
config.c
6
config.c
|
@ -222,7 +222,8 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
|
|||
const char *home_dir = getenv("HOME");
|
||||
|
||||
if (home_dir != NULL)
|
||||
asprintf(&legacy, "%s/%s", home_dir, yml_legacy + 2);
|
||||
if (asprintf(&legacy, "%s/%s", home_dir, yml_legacy + 2) < 0)
|
||||
legacy = NULL;
|
||||
|
||||
if (legacy == NULL)
|
||||
legacy = strdup(yml_legacy);
|
||||
|
@ -246,7 +247,8 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
|
|||
const char *home_dir = getenv("HOME");
|
||||
|
||||
if (home_dir != NULL)
|
||||
asprintf(&template, "%s/%s", home_dir, yml_template + 2);
|
||||
if (asprintf(&template, "%s/%s", home_dir, yml_template + 2) < 0)
|
||||
template = NULL;
|
||||
|
||||
if (template == NULL)
|
||||
template = strdup(yml_template);
|
||||
|
|
Loading…
Add table
Reference in a new issue