aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-04-01 21:10:46 +0800
committerMilan Crha <mcrha@redhat.com>2010-04-01 21:10:46 +0800
commitbf3a5df6d947669e62926ea2d5f25f73503faaaf (patch)
tree456fff4f90bba56a19e59ca49e4f75d184ec7036 /calendar
parent52f8d504fbdcc1b1e517b88d192ff87c2aa0d53e (diff)
downloadgsoc2013-evolution-bf3a5df6d947669e62926ea2d5f25f73503faaaf.tar.gz
gsoc2013-evolution-bf3a5df6d947669e62926ea2d5f25f73503faaaf.tar.zst
gsoc2013-evolution-bf3a5df6d947669e62926ea2d5f25f73503faaaf.zip
Bug #612821 - Uses freed memory when changing task's source
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/comp-editor.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 15384d829d..5fe874d476 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -392,7 +392,8 @@ save_comp (CompEditor *editor)
gboolean result;
GError *error = NULL;
GHashTable *timezones;
- const gchar *orig_uid;
+ const gchar *orig_uid = NULL;
+ gchar *orig_uid_copy;
icalcomponent *icalcomp;
priv = editor->priv;
@@ -440,6 +441,8 @@ save_comp (CompEditor *editor)
priv->comp = clone;
e_cal_component_get_uid (priv->comp, &orig_uid);
+ /* make a copy of it, because call of e_cal_create_object rewrites the internal uid */
+ orig_uid_copy = g_strdup (orig_uid);
/* send timezones */
g_hash_table_foreach (timezones, (GHFunc) send_timezone, editor);
@@ -495,8 +498,10 @@ save_comp (CompEditor *editor)
icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
}
- if (delay_set)
+ if (delay_set) {
+ g_free (orig_uid_copy);
return TRUE;
+ }
}
if (!result) {
@@ -514,6 +519,8 @@ save_comp (CompEditor *editor)
if (error)
g_error_free (error);
+ g_free (orig_uid_copy);
+
return FALSE;
} else {
if (priv->source_client &&
@@ -523,10 +530,10 @@ save_comp (CompEditor *editor)
/* Comp found a new home. Remove it from old one. */
if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp))
- e_cal_remove_object_with_mod (priv->source_client, orig_uid, NULL,
+ e_cal_remove_object_with_mod (priv->source_client, orig_uid_copy, NULL,
CALOBJ_MOD_ALL, NULL);
else
- e_cal_remove_object (priv->source_client, orig_uid, NULL);
+ e_cal_remove_object (priv->source_client, orig_uid_copy, NULL);
/* Let priv->source_client point to new home, so we can move it
* again this session. */
@@ -539,6 +546,8 @@ save_comp (CompEditor *editor)
priv->changed = FALSE;
}
+ g_free (orig_uid_copy);
+
return TRUE;
}