Fix leaks when loading accounts

Review Request #2299 — Created Feb. 28, 2023 and submitted — Latest diff uploaded

Information

pidgin/pidgin
default

Reviewers

Fix two leaks in account parser:

512 bytes in 4 blocks are definitely lost in loss record 30,342 of 33,863
   at 0x484378A: malloc (vg_replace_malloc.c:392)
   by 0x484870B: realloc (vg_replace_malloc.c:1451)
   by 0x498071F: g_realloc (gmem.c:201)
   by 0x499A343: g_string_maybe_expand (gstring.c:92)
   by 0x499A3BF: g_string_sized_new (gstring.c:116)
   by 0x499A7AA: UnknownInlinedFun (gstring.c:176)
   by 0x499A7AA: g_string_new_len (gstring.c:167)
   by 0x4D577C6: purple_xmlnode_get_data (xmlnode.c:460)
   by 0x4CCD5D8: parse_account (accounts.c:338)
   by 0x4CCD98B: load_accounts (accounts.c:449)
   by 0x4CCE234: purple_accounts_init (accounts.c:667)
   by 0x4CE3AC2: purple_core_init (core.c:174)
   by 0x48A380A: pidgin_application_startup (pidginapplication.c:820)

512 bytes in 4 blocks are definitely lost in loss record 30,343 of 33,863
   at 0x484378A: malloc (vg_replace_malloc.c:392)
   by 0x484870B: realloc (vg_replace_malloc.c:1451)
   by 0x498071F: g_realloc (gmem.c:201)
   by 0x499A343: g_string_maybe_expand (gstring.c:92)
   by 0x499A3BF: g_string_sized_new (gstring.c:116)
   by 0x499A7AA: UnknownInlinedFun (gstring.c:176)
   by 0x499A7AA: g_string_new_len (gstring.c:167)
   by 0x4D577C6: purple_xmlnode_get_data (xmlnode.c:460)
   by 0x4CCD610: parse_account (accounts.c:343)
   by 0x4CCD98B: load_accounts (accounts.c:449)
   by 0x4CCE234: purple_accounts_init (accounts.c:667)
   by 0x4CE3AC2: purple_core_init (core.c:174)
   by 0x48A380A: pidgin_application_startup (pidginapplication.c:820)

and one in the demo protocol:

16,008 (56 direct, 15,952 indirect) bytes in 1 blocks are definitely lost in loss record 33,622 of 33,863
   at 0x4DDF1EF: g_type_create_instance (gtype.c:1909)
   by 0x4DC4C1F: g_object_new_internal (gobject.c:2228)
   by 0x4DC6972: g_object_new_valist (gobject.c:2567)
   by 0x4DC6FCC: g_object_new (gobject.c:2040)
   by 0x57CF444: g_resource_open_stream (gresource.c:764)
   by 0x1CAA54A2: purple_demo_contacts_load (purpledemocontacts.c:233)
   by 0x1CAA4CD0: purple_demo_connection_connect (purpledemoconnection.c:43)
   by 0x4CE1540: purple_connection_connect (connection.c:955)
   by 0x4CC7F5E: purple_account_real_connect (account.c:179)
   by 0x4CC85B0: no_password_cb (account.c:355)
   by 0x49784C7: g_timeout_dispatch (gmain.c:5007)
   by 0x4977CBE: UnknownInlinedFun (gmain.c:3444)
   by 0x4977CBE: g_main_context_dispatch (gmain.c:4162)

Ran in valgrind and confirmed above leaks were gone.

Commits

Files

    Loading...