1b5975d6bSopenharmony_ciFrom 6c93ac876f71d7221a172e430ca450b6c0b8b699 Mon Sep 17 00:00:00 2001
2b5975d6bSopenharmony_ciFrom: Marco Trevisan <mail@3v1n0.net>
3b5975d6bSopenharmony_ciDate: Wed, 20 Jul 2022 06:32:30 +0200
4b5975d6bSopenharmony_ciSubject: [PATCH] gregex: Free match info if offset matching recalc failed
5b5975d6bSopenharmony_ci
6b5975d6bSopenharmony_ciIt's not probably ever happening in practice, but coverity found it and
7b5975d6bSopenharmony_ciit's easy enough to fix it.
8b5975d6bSopenharmony_ci
9b5975d6bSopenharmony_ciCoverity CID: #1490730
10b5975d6bSopenharmony_ci
11b5975d6bSopenharmony_ciConflict:NA
12b5975d6bSopenharmony_ciReference:https://gitlab.gnome.org/GNOME/glib/-/commit/6c93ac876f71d7221a172e430ca450b6c0b8b699
13b5975d6bSopenharmony_ci
14b5975d6bSopenharmony_ci---
15b5975d6bSopenharmony_ci glib/gregex.c | 5 ++++-
16b5975d6bSopenharmony_ci 1 file changed, 4 insertions(+), 1 deletion(-)
17b5975d6bSopenharmony_ci
18b5975d6bSopenharmony_cidiff --git a/glib/gregex.c b/glib/gregex.c
19b5975d6bSopenharmony_ciindex 5fc7b16bc8..be03f0e094 100644
20b5975d6bSopenharmony_ci--- a/glib/gregex.c
21b5975d6bSopenharmony_ci+++ b/glib/gregex.c
22b5975d6bSopenharmony_ci@@ -2237,7 +2237,10 @@ g_regex_match_all_full (const GRegex      *regex,
23b5975d6bSopenharmony_ci                                        info->workspace, info->n_workspace);
24b5975d6bSopenharmony_ci 
25b5975d6bSopenharmony_ci       if (!recalc_match_offsets (info, error))
26b5975d6bSopenharmony_ci-        return FALSE;
27b5975d6bSopenharmony_ci+        {
28b5975d6bSopenharmony_ci+          g_match_info_free (info);
29b5975d6bSopenharmony_ci+          return FALSE;
30b5975d6bSopenharmony_ci+        }
31b5975d6bSopenharmony_ci 
32b5975d6bSopenharmony_ci       if (info->matches == PCRE2_ERROR_DFA_WSSIZE)
33b5975d6bSopenharmony_ci         {
34b5975d6bSopenharmony_ci-- 
35b5975d6bSopenharmony_ciGitLab
36b5975d6bSopenharmony_ci
37