From a86fb2760712ec8055464c0d96478cee0db81820 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 13 May 2024 17:29:15 +0200 Subject: [PATCH] cov: ensure pointer has defined value Add initialization of 'fin' pointer. --- device_mapper/libdm-report.c | 4 ++-- libdm/libdm-report.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c index 6d861fdb4..d6d485964 100644 --- a/device_mapper/libdm-report.c +++ b/device_mapper/libdm-report.c @@ -4107,7 +4107,7 @@ static int _alloc_rh_selection(struct dm_report *rh) static int _report_set_selection(struct dm_report *rh, const char *selection, int add_new_fields) { struct selection_node *root = NULL; - const char *fin, *next; + const char *fin = NULL, *next; if (rh->selection) { if (rh->selection->selection_root) @@ -4127,7 +4127,7 @@ static int _report_set_selection(struct dm_report *rh, const char *selection, in if (!(root = _alloc_selection_node(rh->selection->mem, SEL_OR))) return 0; - if (!_parse_or_ex(rh, selection, &fin, root)) + if (!_parse_or_ex(rh, selection, &fin, root) || !fin) goto_bad; next = _skip_space(fin); diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index f4d7ee32b..95d5733a2 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -4105,7 +4105,7 @@ static int _alloc_rh_selection(struct dm_report *rh) static int _report_set_selection(struct dm_report *rh, const char *selection, int add_new_fields) { struct selection_node *root = NULL; - const char *fin, *next; + const char *fin = NULL, *next; if (rh->selection) { if (rh->selection->selection_root) @@ -4125,7 +4125,7 @@ static int _report_set_selection(struct dm_report *rh, const char *selection, in if (!(root = _alloc_selection_node(rh->selection->mem, SEL_OR))) return 0; - if (!_parse_or_ex(rh, selection, &fin, root)) + if (!_parse_or_ex(rh, selection, &fin, root) || !fin) goto_bad; next = _skip_space(fin);