[vte] widget: Fix mem leak in search_rows()
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [vte] widget: Fix mem leak in search_rows()
- Date: Mon, 22 Jan 2018 12:39:52 +0000 (UTC)
commit b274318f2e48573569d65b17cd2c4ead916e7d6a
Author: Egmont Koblinger <egmont gmail com>
Date:   Mon Jan 22 13:38:49 2018 +0100
    widget: Fix mem leak in search_rows()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792740
 src/vte.cc |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 4343f1f..0526c53 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -11456,17 +11456,23 @@ VteTerminalPrivate::search_rows(pcre2_match_context_8 *match_context,
                      match_data,
                      match_context);
 
-        if (r == PCRE2_ERROR_NOMATCH)
+        if (r == PCRE2_ERROR_NOMATCH) {
+                g_string_free (row_text, TRUE);
                 return false;
+        }
         // FIXME: handle partial matches (PCRE2_ERROR_PARTIAL)
-        if (r < 0)
+        if (r < 0) {
+                g_string_free (row_text, TRUE);
                 return false;
+        }
 
         ovector = pcre2_get_ovector_pointer_8(match_data);
         so = ovector[0];
         eo = ovector[1];
-        if (G_UNLIKELY(so == PCRE2_UNSET || eo == PCRE2_UNSET))
+        if (G_UNLIKELY(so == PCRE2_UNSET || eo == PCRE2_UNSET)) {
+                g_string_free (row_text, TRUE);
                 return false;
+        }
 
         start = so;
         end = eo;
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]