From f923261fecf8147dc0fde23a833ca19627287e32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 11 Jul 2023 12:40:14 +0200 Subject: [PATCH] =?UTF-8?q?config:=20don=E2=80=99t=20ignore=20asprintf()?= =?UTF-8?q?=20return=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index debf837..2ad305f 100644 --- a/config.c +++ b/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);