[gtkmm] add_item(): Correct a memory allocation to avoid a crash later. Bug #585521



commit 7700a0b6845108688dd055f28f83e3259d5c36c0
Author: Hakim Bellam <hakim bellam gmail com>
Date:   Tue Jun 16 18:57:12 2009 +0200

    add_item(): Correct a memory allocation to avoid a crash later. Bug #585521

 ChangeLog                 |    5 +++++
 gtk/src/recentmanager.ccg |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2cf1d0b..a75bc98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-16   Hakim Bellam  <hakim bellam gmail com>
+
+	* gtk/src/recentmanager.ccg: add_item(): Correct a memory allocation to 
+	avoid a crash later. Bug #585521.
+
 2009-06-14  Armin Burgmeier  <armin openismus com>
 
 	* win32_installer/gtkmm-installer.nsi.in: Don't create a broken
diff --git a/gtk/src/recentmanager.ccg b/gtk/src/recentmanager.ccg
index 077437b..b39ab07 100644
--- a/gtk/src/recentmanager.ccg
+++ b/gtk/src/recentmanager.ccg
@@ -34,7 +34,7 @@ bool RecentManager::add_item(const Glib::ustring& uri, const Data& data)
   c_data.mime_type = const_cast<gchar*>(data.mime_type.c_str());
   c_data.app_name = const_cast<gchar*>(data.app_name.c_str());
   c_data.app_exec = const_cast<gchar*>(data.app_exec.c_str());
-  c_data.groups = static_cast<gchar**>(g_malloc((data.groups.size() + 1) * sizeof(gchar)));
+  c_data.groups = static_cast<gchar**>(g_malloc((data.groups.size() + 1) * sizeof(*gchar)));
   for(unsigned int i = 0; i < data.groups.size(); ++ i)
     c_data.groups[i] = const_cast<gchar*>(data.groups[i].c_str());
   c_data.groups[data.groups.size()] = NULL;



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