[geany/geany] 69d829: Don't try to unref NULL regex

Colomban Wendling git-noreply at xxxxx
Sun Sep 2 12:17:34 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 02 Sep 2012 12:17:34
Commit:      69d8295c5ea91f88a33ec41c523c6c9f47e346c9
             https://github.com/geany/geany/commit/69d8295c5ea91f88a33ec41c523c6c9f47e346c9

Log Message:
-----------
Don't try to unref NULL regex


Modified Paths:
--------------
    src/search.c

Modified: src/search.c
6 files changed, 4 insertions(+), 2 deletions(-)
===================================================================
@@ -1256,9 +1256,10 @@ gint search_mark_all(GeanyDocument *doc, const gchar *search_text, gint flags)
 		if (search_data.flags & SCFIND_REGEXP)
 		{
 			GRegex *regex = compile_regex(search_data.text, search_data.flags);
-			g_regex_unref(regex);
 			if (!regex)
 				goto fail;
+			else
+				g_regex_unref(regex);
 		}
 		else if (settings.find_escape_sequences)
 		{
@@ -1389,7 +1390,8 @@ static void replace_in_session(GeanyDocument *doc,
 	if (search_flags_re & SCFIND_REGEXP)
 	{
 		GRegex *regex = compile_regex(find, search_flags_re);
-		g_regex_unref(regex);
+		if (regex)
+			g_regex_unref(regex);
 		/* find escapes will be handled by GRegex */
 		if (!regex || !utils_str_replace_escape(replace, TRUE))
 			goto fail;


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list