summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2022-11-14 16:10:46 +0200
committerPetri Latvala <petri.latvala@intel.com>2022-11-15 12:15:58 +0200
commite2138d48c2c506816868c16cf3ba64f81bdead41 (patch)
tree427b720775e3d1437ba25a9aee4a44cb6859ea12 /runner
parent05096a6754048f4b5a2de798ab4bea32012b556a (diff)
runner: Fix a memory leak in stderr_contains_warnings
The matches object's internals weren't released. v2: Don't leak in the other branch either. (Kamil) Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arek@hiler.eu> Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Diffstat (limited to 'runner')
-rw-r--r--runner/resultgen.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/runner/resultgen.c b/runner/resultgen.c
index 3d7538286..05c4234e9 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -1902,17 +1902,22 @@ static bool stderr_contains_warnings(const char *beg, const char *end)
};
struct matches matches;
size_t i = 0;
+ bool found = false;
matches = find_matches(beg, end, needles);
while (i < matches.size) {
- if (matches.items[i].where != beg)
- return true;
+ if (matches.items[i].where != beg) {
+ found = true;
+ break;
+ }
beg = next_line(beg, end);
i++;
}
- return false;
+ free_matches(&matches);
+
+ return found;
}
static bool json_field_has_data(struct json_object *obj, const char *key)