[gnome-system-log] log: make sure to always NULL-terminate log lines array



commit af6e5f3fd809ec7e477434e8279d1b2f8817f33d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 11 17:23:41 2013 -0400

    log: make sure to always NULL-terminate log lines array
    
    Even when we get an error, or we'll segfault when calling g_strfreev()
    on it later.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=697790

 src/logview-log.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/logview-log.c b/src/logview-log.c
index 292f160..57b9cd5 100644
--- a/src/logview-log.c
+++ b/src/logview-log.c
@@ -298,14 +298,14 @@ do_read_new_lines (GIOSchedulerJob *io_job,
     g_ptr_array_add (lines, (gpointer) line);
   }
 
+  /* NULL-terminate the array again */
+  g_ptr_array_add (lines, NULL);
+
   if (err) {
     job->err = err;
     goto out;
   }
 
-  /* NULL-terminate the array again */
-  g_ptr_array_add (lines, NULL);
-
   log->priv->has_new_lines = FALSE;
 
   /* we'll return only the new lines in the callback */


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