Re: [Evolution] IMAP issues



shouldn't it be:

if (!headers_p || !*headers_p) {
   g_free (headers_p);
   return NULL;
}

???

Otherwise it looks like we leak a little bit (not that it'll kill us,
but still).

Jeff

On 13 Mar 2001 21:39:40 +0500, Dan Winship wrote:
Can you try this patch?



--=-VWKvf+pXj7nxCI2cHMns
Index: camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.170
diff -u -r1.170 camel-imap-folder.c
--- camel-imap-folder.c       2001/02/26 21:38:39     1.170
+++ camel-imap-folder.c       2001/03/13 16:19:27
@@ -780,18 +780,22 @@
 
      *headers_p = strchr (*headers_p, ' ');
      if (!*headers_p)
-             return FALSE;
+             return NULL;
      (*headers_p)++;
 
      headers = imap_parse_nstring (headers_p, &len);
-     if (!headers)
-             return FALSE;
-     stream = camel_stream_mem_new_with_buffer (headers, len);
-     g_free (headers);
+     if (!*headers_p)
+             return NULL;
 
      medium = CAMEL_MEDIUM (camel_object_new (medium_type));
-     camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (medium), stream);
-     camel_object_unref (CAMEL_OBJECT (stream));
+
+     if (headers) {
+             stream = camel_stream_mem_new_with_buffer (headers, len);
+             g_free (headers);
+
+             camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (medium), stream);
+             camel_object_unref (CAMEL_OBJECT (stream));
+     }
 
      return medium;
 }





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