From 748b3f74c0ea800a05c7e2c83b7472f000a302eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Mon, 22 Dec 2014 14:36:18 -0500 Subject: [PATCH] manager: fix gchar** memory allocation I had totally forgot you need to end the array with NULL. --- src/gcal-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gcal-manager.c b/src/gcal-manager.c index 8adae2ff..aa66b07c 100644 --- a/src/gcal-manager.c +++ b/src/gcal-manager.c @@ -834,7 +834,7 @@ gcal_manager_enable_source (GcalManager *manager, e_cal_data_model_add_client (priv->search_data_model, unit->client); /* remove source's uid from disabled_sources array */ - new_disabled_sources = g_malloc0_n (g_strv_length (priv->disabled_sources) - 1, sizeof (gchar*)); + new_disabled_sources = g_new0 (gchar*, g_strv_length (priv->disabled_sources)); for (i = 0; i < g_strv_length (priv->disabled_sources); i++) { if (g_strcmp0 (priv->disabled_sources[i], e_source_get_uid (source)) == 0) @@ -875,7 +875,7 @@ gcal_manager_disable_source (GcalManager *manager, e_cal_data_model_remove_client (priv->search_data_model, e_source_get_uid (source)); /* add source's uid from disabled_sources array */ - new_disabled_sources = g_malloc0_n (g_strv_length (priv->disabled_sources) + 1, sizeof (gchar*)); + new_disabled_sources = g_new0 (gchar*, g_strv_length (priv->disabled_sources) + 2); for (i = 0; i < g_strv_length (priv->disabled_sources); i++) new_disabled_sources[i] = g_strdup (priv->disabled_sources[i]);