changeset 28343:fe49bedd5aee

Nullify the freed pointer so it's not accessed later.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 08 Oct 2009 18:03:05 +0000
parents 65e8c39cc5f6
children 6b328370cad0
files finch/libgnt/gnttextview.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gnttextview.c	Thu Oct 08 17:41:41 2009 +0000
+++ b/finch/libgnt/gnttextview.c	Thu Oct 08 18:03:05 2009 +0000
@@ -767,6 +767,7 @@
 							line->segments = g_list_delete_link(line->segments, segs);
 							if (line->segments == NULL) {
 								free_text_line(line, NULL);
+								line = NULL;
 								if (view->list == iter) {
 									if (inext)
 										view->list = inext;
@@ -780,7 +781,8 @@
 							seg->start = tag->start;
 							seg->end = tag->end - change;
 						}
-						line->length -= change;
+						if (line)
+							line->length -= change;
 						/* XXX: Make things work if the tagged text spans over several lines. */
 					} else {
 						/* XXX: handle the rest of the conditions */