[evolution] Avoid use-after-free in em_config_target_update_settings
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Avoid use-after-free in em_config_target_update_settings
- Date: Thu, 15 Dec 2011 13:46:20 +0000 (UTC)
commit a9cea92f5e356655013e20be8f1a94543c9ed72f
Author: Milan Crha <mcrha redhat com>
Date: Thu Dec 15 14:45:57 2011 +0100
Avoid use-after-free in em_config_target_update_settings
mail/em-config.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/mail/em-config.c b/mail/em-config.c
index 1e02532..fbf27fa 100644
--- a/mail/em-config.c
+++ b/mail/em-config.c
@@ -207,6 +207,8 @@ em_config_target_update_settings (EConfig *ep,
const gchar *transport_protocol,
CamelSettings *transport_settings)
{
+ gchar *tmp;
+
g_return_if_fail (ep != NULL);
g_return_if_fail (target != NULL);
@@ -228,8 +230,10 @@ em_config_target_update_settings (EConfig *ep,
if (target->transport_settings != NULL)
g_object_unref (target->transport_settings);
+ /* the pointers can be same, thus avoid use-after-free */
+ tmp = g_strdup (email_address);
g_free (target->email_address);
- target->email_address = g_strdup (email_address);
+ target->email_address = tmp;
target->storage_protocol = storage_protocol;
target->storage_settings = storage_settings;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]