changeset 31546:14c400cd051e

gtksourceiter: Fix a few memory leaks in our bundled copy of this widget. Refs #13162. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author morshed.nader@gmail.com
date Wed, 05 Jan 2011 16:22:00 +0000
parents 8e29b6fff216
children e9f62dfd2dd8
files pidgin/gtksourceiter.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksourceiter.c	Wed Jan 05 16:21:21 2011 +0000
+++ b/pidgin/gtksourceiter.c	Wed Jan 05 16:22:00 2011 +0000
@@ -154,7 +154,7 @@
 	p = g_utf8_offset_to_pointer (caseless_haystack, i);
 	needle_len = strlen (needle);
 
-	while (p >= caseless_haystack)
+	while (1)
 	{
 		if (strncmp (p, needle, needle_len) == 0)
 		{
@@ -162,7 +162,11 @@
 			goto finally_1;
 		}
 
-		p = g_utf8_prev_char (p);
+		if (p > caseless_haystack)
+			p = g_utf8_prev_char (p);
+		else
+			goto finally_1;
+
 		i--;
 	}