Fix a possible use-after-free for ContactData pointers in new addressbook.
[claws.git] / src / addressbook-dbus.c
index 00c6eaa9fb03ec5c7d08594e090b59d9f6b170fe..eb71e7b1dfab51e6b7d05cdd76c10c167c0712fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  */
-/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: */
+/* vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:��,trail\:�: */
 
 /*
  * Claws-contacts is a proposed new design for the address book feature
@@ -12,7 +12,7 @@
  * More lightweight is achieved by design, in that sence that the whole
  * structure is based on a plugable design.
  *
- * Claws Mail is Copyright (C) 1999-2011 by the Claws Mail Team and
+ * Claws Mail is Copyright (C) 1999-2012 by the Claws Mail Team and
  * Claws-contacts is Copyright (C) 2011 by Michael Rasmussen.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -64,7 +64,7 @@ static gboolean init(GError** error) {
     if (connection == NULL || *error) {
                if (! *error)
                        g_set_error(error, client_object_error_quark(), 1, "Unable to connect to dbus");
-        g_warning("Unable to connect to dbus: %s\n", (*error)->message);
+        g_warning("Unable to connect to dbus: %s", (*error)->message);
         return FALSE;
     }
     
@@ -73,7 +73,7 @@ static gboolean init(GError** error) {
             "/org/clawsmail/contacts",
             "org.clawsmail.Contacts");
     if (proxy == NULL) {
-        g_warning("Could not get a proxy object\n");
+        g_warning("Could not get a proxy object");
         g_set_error(error, client_object_error_quark(), 1, "Could not get a proxy object");
         return FALSE;
     }
@@ -125,7 +125,7 @@ static gchar* convert_2_utf8(gchar* locale) {
 
     utf8 = g_convert(locale, -1, "UTF-8", current, &read, &write, &error);
     if (error) {
-        g_warning("Fail to convert [%s]: %s\n", charset, error->message);
+        g_warning("Failed to convert [%s]: %s", charset, error->message);
         g_free(current);
         return NULL;
     }
@@ -399,7 +399,7 @@ void contact_data_free(ContactData** data) {
        g_free(contact->name);
        g_free(contact->book);
        g_free(contact);
-       contact = NULL;
+       *data = NULL;
 }
 
 void addressbook_harvest(FolderItem *folderItem,
@@ -478,7 +478,7 @@ static gboolean my_compose_create_hook(gpointer source, gpointer user_data) {
 void addressbook_install_hooks(GError** error) {
        if ((guint)-1 == hooks_register_hook(
                        COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL)) {
-               g_warning("Could not register hook for adding vCards\n");
+               g_warning("Could not register hook for adding vCards");
                if (error) {
                        g_set_error(error, client_object_error_quark(), 1,
                                "Could not register hook for adding vCards");