[evolution-data-server] CamelPOP3Folder: Fix a potential g_object_unref(NULL) call



commit 1161f3fbc1f6018fbc163b2f3078c5938f983c19
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Dec 3 14:55:29 2013 -0500

    CamelPOP3Folder: Fix a potential g_object_unref(NULL) call
    
    If all the branch conditions in this function evaluate to FALSE, the
    stream is never set, and hence g_object_unref(NULL) is called on exiting
    the function.
    
    Found by scan-build.
    
    https://bugzilla.gnome.org/719533

 camel/providers/pop3/camel-pop3-folder.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 4aec0e6..6d08762 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -552,7 +552,7 @@ pop3_folder_get_message_sync (CamelFolder *folder,
        }
 
        message = camel_mime_message_new ();
-       if (!camel_data_wrapper_construct_from_stream_sync (
+       if (stream != NULL && !camel_data_wrapper_construct_from_stream_sync (
                CAMEL_DATA_WRAPPER (message), stream, cancellable, error)) {
                g_prefix_error (error, _("Cannot get message %s: "), uid);
                g_object_unref (message);
@@ -562,7 +562,7 @@ pop3_folder_get_message_sync (CamelFolder *folder,
                camel_medium_add_header (CAMEL_MEDIUM (message), "X-Evolution-POP3-UID", uid);
        }
 done:
-       g_object_unref (stream);
+       g_clear_object (&stream);
 fail:
        g_clear_object (&pop3_engine);
 


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