From c3045ecebb837eb87c4b7bb6e99354f96e04d075 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 19 Nov 2023 17:17:54 +0100 Subject: [PATCH] confd: fix obvious mistakes in checking return values Found by Coverty Scan Signed-off-by: Joachim Wiberg --- src/confd/src/ietf-interfaces.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index e3aa3a0a..cfff1bfc 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -69,9 +69,13 @@ static char *iface_xpath(const char *xpath) { char *path, *ptr; + if (!xpath) + return NULL; + path = strdup(xpath); if (!path) return NULL; + if (!(ptr = strstr(path, "]/"))) { free(path); return NULL; @@ -219,7 +223,7 @@ static int ifchange_cand_infer_type(sr_session_ctx_t *session, const char *path) sr_error_t err = SR_ERR_OK; xpath = iface_xpath(path); - if (!path) + if (!xpath) return SR_ERR_SYS; type = srx_get_str(session, "%s/type", xpath);