[evolution-data-server/gnome-3-8] GError instance use-after-free in collection_backend_load_resources()



commit 8aa61147f3cd80ddf856869764748c4a967d505b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 1 12:00:11 2013 +0200

    GError instance use-after-free in collection_backend_load_resources()
    
    The function uses a shared GError instance in a cycle, and on error
    freed the instance with g_error_free() which left the pointer set,
    only populated with freed memory, thus the next round, when it eventually
    loaded correct source, the function thought it ended with an error
    and a GSlice allocator aborted on the g_error_free() call. Resetting
    the error variable to NULL after free (by using g_clear_error()) fixes
    the crash.

 libebackend/e-collection-backend.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libebackend/e-collection-backend.c b/libebackend/e-collection-backend.c
index 4b73e55..7a77a49 100644
--- a/libebackend/e-collection-backend.c
+++ b/libebackend/e-collection-backend.c
@@ -246,7 +246,7 @@ collection_backend_load_resources (ECollectionBackend *backend)
                if (error != NULL) {
                        g_warn_if_fail (source == NULL);
                        g_warning ("%s: %s", G_STRFUNC, error->message);
-                       g_error_free (error);
+                       g_clear_error (&error);
                        continue;
                }
 


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