From be55658b02690d080681bc119a8b418f9a7b2291 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 3 Oct 2014 18:44:38 +0200 Subject: [PATCH] config: fix the s1 string handling (coverity) --- src/config.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/config.c b/src/config.c index 5cbdc85d..81acfb2f 100644 --- a/src/config.c +++ b/src/config.c @@ -787,12 +787,15 @@ config_modify_dvr_log( htsmsg_t *c, uint32_t id, const char *uuid, const void *a if ((s1 = htsmsg_get_str(c, "autorec")) != NULL) { s1 = strdup(s1); htsmsg_delete_field(c, "autorec"); - HTSMSG_FOREACH(f, list) { - if (!(e = htsmsg_field_get_map(f))) continue; - if (strcmp(s1, htsmsg_get_str(e, "id") ?: "") == 0) { - htsmsg_add_str(c, "autorec", htsmsg_get_str(e, "uuid")); - break; + if (s1 != NULL) { + HTSMSG_FOREACH(f, list) { + if (!(e = htsmsg_field_get_map(f))) continue; + if (strcmp(s1, htsmsg_get_str(e, "id") ?: "") == 0) { + htsmsg_add_str(c, "autorec", htsmsg_get_str(e, "uuid")); + break; + } } + free((char *)s1); } } }