[dconf] dbus1/: fix malloc() off-by-one error



commit b344256833f07f897235ce3405a0b2589ab7b518
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Jul 16 15:32:32 2012 -0400

    dbus1/: fix malloc() off-by-one error
    
    Make sure we allocate enough room for the NULL at the end of the
    gchar**.

 dbus-1/dconf-dbus-1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/dbus-1/dconf-dbus-1.c b/dbus-1/dconf-dbus-1.c
index 9bf39ff..500700d 100644
--- a/dbus-1/dconf-dbus-1.c
+++ b/dbus-1/dconf-dbus-1.c
@@ -53,7 +53,7 @@ dconf_engine_change_notify (DConfEngine         *engine,
   gint i;
 
   n_changes = g_strv_length ((gchar **) changes);
-  my_changes = g_new (gchar *, n_changes);
+  my_changes = g_new (gchar *, n_changes + 1);
 
   for (i = 0; i < n_changes; i++)
     my_changes[i] = g_strconcat (prefix, changes[i], NULL);



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