Patch major memory leak due to GMime bindings

Discovered a few binding problems while working on another issue,
in particular gmime_parser_construct_message()'s return object
not being freed, which can hold an entire message (attachments and
all) in memory.
This commit is contained in:
Jim Nelson 2014-07-30 19:02:11 -07:00
parent 9933f2d3fe
commit f1c75fc465
3 changed files with 20 additions and 9 deletions

View file

@ -173,7 +173,7 @@ namespace GMime {
[CCode (cname = "g_mime_content_type_set_params")]
public void set_params (GMime.Param @params);
[CCode (cname = "g_mime_content_type_to_string")]
public unowned string to_string ();
public string to_string ();
}
[CCode (cheader_filename = "gmime/gmime.h")]
public class CryptoContext : GLib.Object {
@ -546,7 +546,7 @@ namespace GMime {
[CCode (cname = "g_mime_message_get_date")]
public void get_date (out ulong date, out int tz_offset);
[CCode (cname = "g_mime_message_get_date_as_string")]
public unowned string get_date_as_string ();
public string get_date_as_string ();
[CCode (cname = "g_mime_message_get_message_id")]
public unowned string get_message_id ();
[CCode (cname = "g_mime_message_get_mime_part")]
@ -639,9 +639,9 @@ namespace GMime {
[CCode (cname = "g_mime_multipart_remove")]
public virtual bool remove (GMime.Object part);
[CCode (cname = "g_mime_multipart_remove_at")]
public virtual unowned GMime.Object remove_at (int index);
public virtual GMime.Object remove_at (int index);
[CCode (cname = "g_mime_multipart_replace")]
public unowned GMime.Object replace (int index, GMime.Object replacement);
public GMime.Object replace (int index, GMime.Object replacement);
[CCode (cname = "g_mime_multipart_set_boundary")]
public virtual void set_boundary (string boundary);
[CCode (cname = "g_mime_multipart_set_postface")]
@ -698,7 +698,7 @@ namespace GMime {
[CCode (cname = "g_mime_object_get_header_list")]
public unowned GMime.HeaderList get_header_list ();
[CCode (cname = "g_mime_object_get_headers")]
public virtual unowned string get_headers ();
public virtual string get_headers ();
[CCode (cname = "g_mime_object_prepend_header")]
public virtual void prepend_header (string header, string value);
[CCode (cname = "g_mime_object_register_type")]
@ -758,9 +758,9 @@ namespace GMime {
[CCode (cname = "g_mime_parser_new", has_construct_function = false)]
public Parser ();
[CCode (cname = "g_mime_parser_construct_message")]
public unowned GMime.Message? construct_message ();
public GMime.Message? construct_message ();
[CCode (cname = "g_mime_parser_construct_part")]
public unowned GMime.Object construct_part ();
public GMime.Object? construct_part ();
[CCode (cname = "g_mime_parser_eos")]
public bool eos ();
[CCode (cname = "g_mime_parser_get_from")]
@ -1016,6 +1016,8 @@ namespace GMime {
public bool owner;
[CCode (cname = "g_mime_stream_file_new", has_construct_function = false, type = "GMimeStream*")]
public StreamFile (GLib.FileStream fp);
[CCode (cname = "g_mime_stream_file_new_for_path", has_construct_function = false, type = "GMimeStream*")]
public StreamFile.for_path (string path, string mode);
[CCode (cname = "g_mime_stream_file_get_owner")]
public bool get_owner ();
[CCode (cname = "g_mime_stream_file_set_owner")]
@ -1040,6 +1042,8 @@ namespace GMime {
public bool owner;
[CCode (cname = "g_mime_stream_fs_new", has_construct_function = false, type = "GMimeStream*")]
public StreamFs (int fd);
[CCode (cname = "g_mime_stream_fs_new_for_path", has_construct_function = false, type = "GMimeStream*")]
public StreamFs.for_path (string path, int flags, int mode);
[CCode (cname = "g_mime_stream_fs_get_owner")]
public bool get_owner ();
[CCode (cname = "g_mime_stream_fs_set_owner")]

View file

@ -1,2 +1,2 @@
include/gmime-2.6/
lib/libgmime-2.6.so
lib/x86_64-linux-gnu/libgmime-2.6.so

View file

@ -3,16 +3,22 @@ GMime lower_case_cprefix="gmime_" cheader_filename="gmime/gmime.h"
GMimeObject abstract="1"
GMimeStream abstract="1"
g_mime_content_type_to_string transfer_ownership="1"
g_mime_header_list_get_iter.iter is_out="1"
g_mime_message_get_date.date is_out="1"
g_mime_message_get_date.tz_offset is_out="1"
g_mime_message_get_date_as_string transfer_ownership="1"
g_mime_message_get_mime_part is_nullable="1"
g_mime_multipart_remove_at is_nullable="1" transfer_ownership="1"
g_mime_multipart_replace is_nullable="1" transfer_ownership="1"
g_mime_object_get_content_disposition nullable="1"
g_mime_object_get_content_type nullable="1"
g_mime_object_get_content_type_parameter nullable="1"
g_mime_object_get_headers transfer_ownership="1"
g_mime_object_to_string transfer_ownership="1"
g_mime_param_next name="get_next"
g_mime_parser_construct_message nullable="1"
g_mime_parser_construct_message nullable="1" transfer_ownership="1"
g_mime_parser_construct_part nullable="1" transfer_ownership="1"
g_mime_part_get_content_description nullable="1"
g_mime_part_get_content_location nullable="1"
g_mime_part_get_content_id nullable="1"
@ -50,6 +56,7 @@ GMimeFilter.outpre is_protected="1"
GMimeFilter.outptr type_name="char*" is_protected="1"
GMimeFilter.outreal type_name="char*" is_protected="1"
GMimeFilter.outsize hidden="1" is_protected="1"
GMimeFilterBest.charset hidden="1"
g_mime_filter_backup.data is_array="1" array_length_pos="1.1" array_length_type="size_t" type_name="char[]"
g_mime_filter_backup.length hidden="1"