[gtk+/gtk-2-24] label: Avoid a possible NULL dereference



commit 69319811142665613cbf2f4c9d8c5874ac2628c9
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 13 13:39:47 2015 -0500

    label: Avoid a possible NULL dereference
    
    We were setting attr->start before checking attr for being NULL.
    
    Pointed out by Sami Farin,
    https://bugzilla.redhat.com/show_bug.cgi?id=1140414

 gtk/gtklabel.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 6ac7bfa..202ee54 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1295,11 +1295,12 @@ pango_start_element (GMarkupParseContext *context,
        }
 
       attr = attribute_from_text (data->builder, name, value, error);
-      attr->start_index = start_val;
-      attr->end_index   = end_val;
 
       if (attr)
        {
+          attr->start_index = start_val;
+          attr->end_index   = end_val;
+
          if (!data->attrs)
            data->attrs = pango_attr_list_new ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]