otrv4 / pidgin-otrng

Fork of https://bugs.otr.im/plugins/pidgin-otr. This is a mirror of https://bugs.otr.im/otrv4/pidgin-otrng
GNU General Public License v2.0
16 stars 5 forks source link

Fix some memory leaks #45

Open claucece opened 6 years ago

claucece commented 6 years ago

This memory leaks show up:

==23601== 16 bytes in 1 blocks are possibly lost in loss record 3,524 of 16,930
==23601==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23601==    by 0x20A28580: otrl_mem_malloc (mem.c:60)
==23601==    by 0x1046CD79: do_malloc (global.c:945)
==23601==    by 0x1046E4E9: _gcry_malloc_secure_core (global.c:979)
==23601==    by 0x1046E4E9: _gcry_xmalloc_secure (global.c:1178)
==23601==    by 0x1046E5C5: _gcry_xcalloc_secure (global.c:1223)
==23601==    by 0x10533982: _gcry_mpi_resize (mpiutil.c:187)
==23601==    by 0x10531586: mpi_fromstr (mpicoder.c:134)
==23601==    by 0x10531586: _gcry_mpi_scan (mpicoder.c:602)
==23601==    by 0x10469D7C: gcry_mpi_scan (visibility.c:357)
==23601==    by 0x21E91584: otrng_dh_init (dh.c:89)
==23601==    by 0x21C5F65B: __otrng_init_plugin (otrng-plugin.c:94)
==23601==    by 0x21C5F6D2: purple_init_plugin (otrng-plugin.c:109)
==23601==    by 0x7E28129: purple_plugin_probe (in /usr/lib64/libpurple.so.0.13.0)

==23601== 240 bytes in 2 blocks are definitely lost in loss record 15,484 of 16,930
==23601==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23601==    by 0xAB5E03E: getdelim (in /usr/lib64/libc-2.27.so)
==23601==    by 0x21C61184: protocol_and_account_to_purple_conversation (plugin-all.c:186)
==23601==    by 0x21E967A8: otrng_user_state_private_key_v4_read_FILEp (messaging.c:253)
==23601==    by 0x21C611E7: otrng_plugin_read_private_keys (plugin-all.c:202)
==23601==    by 0x21C658F1: otrng_plugin_init_userstate (plugin-all.c:2026)
==23601==    by 0x21C66014: otrng_plugin_load (plugin-all.c:2249)
==23601==    by 0x7E27592: purple_plugin_load (in /usr/lib64/libpurple.so.0.13.0)
==23601==    by 0x7E28696: purple_plugins_load_saved (in /usr/lib64/libpurple.so.0.13.0)
==23601==    by 0x143832: main (gtkmain.c:852)

==23601== 240 bytes in 2 blocks are definitely lost in loss record 15,485 of 16,930
==23601==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23601==    by 0xAB5E03E: getdelim (in /usr/lib64/libc-2.27.so)
==23601==    by 0x21C61184: protocol_and_account_to_purple_conversation (plugin-all.c:186)
==23601==    by 0x21E96830: otrng_user_state_client_profile_read_FILEp (messaging.c:276)
==23601==    by 0x21C6129D: otrng_plugin_read_client_profile (plugin-all.c:212)
==23601==    by 0x21C658FD: otrng_plugin_init_userstate (plugin-all.c:2029)
==23601==    by 0x21C66014: otrng_plugin_load (plugin-all.c:2249)
==23601==    by 0x7E27592: purple_plugin_load (in /usr/lib64/libpurple.so.0.13.0)
==23601==    by 0x7E28696: purple_plugins_load_saved (in /usr/lib64/libpurple.so.0.13.0)
==23601==    by 0x143832: main (gtkmain.c:852)

==23601== 1,012 bytes in 2 blocks are possibly lost in loss record 16,374 of 16,930
==23601==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23601==    by 0x20A28580: otrl_mem_malloc (mem.c:60)
==23601==    by 0x1046CD79: do_malloc (global.c:945)
==23601==    by 0x1046D589: _gcry_malloc (global.c:969)
==23601==    by 0x10470B83: _gcry_sexp_find_token (sexp.c:486)
==23601==    by 0x20A23EAB: otrl_privkey_read_FILEp (privkey.c:266)
==23601==    by 0x21E964AF: otrng_user_state_private_key_v3_read_FILEp (messaging.c:144)
==23601==    by 0x21C61200: otrng_plugin_read_private_keys (plugin-all.c:204)
==23601==    by 0x21C658F1: otrng_plugin_init_userstate (plugin-all.c:2026)
==23601==    by 0x21C66014: otrng_plugin_load (plugin-all.c:2249)
==23601==    by 0x7E27592: purple_plugin_load (in /usr/lib64/libpurple.so.0.13.0)
==23601==    by 0x7E28696: purple_plugins_load_saved (in /usr/lib64/libpurple.so.0.13.0)

==23247== 75 (32 direct, 43 indirect) bytes in 1 blocks are definitely lost in loss record 11,977 of 17,344
==23247==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23247==    by 0x21C63424: otrng_plugin_conversation_new (plugin-all.c:1029)
==23247==    by 0x21C635C3: purple_conversation_to_plugin_conversation (plugin-all.c:1068)
==23247==    by 0x21C7083F: build_otr_menu (gtk-dialog.c:2114)
==23247==    by 0x21C72ED5: otrng_gtk_dialog_new_purple_conv (gtk-dialog.c:2963)
==23247==    by 0x21C72620: conversation_switched (gtk-dialog.c:2760)
==23247==    by 0x7E3BCF1: purple_signal_emit_vargs (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x7E3BE61: purple_signal_emit (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x995BADC: g_closure_invoke (gclosure.c:804)
==23247==    by 0x996EA3D: signal_emit_unlocked_R (gsignal.c:3705)
==23247==    by 0x9978069: g_signal_emit_valist (gsignal.c:3391)
==23247==    by 0x9978662: g_signal_emit (gsignal.c:3447)

==23247== 96 bytes in 6 blocks are possibly lost in loss record 14,761 of 17,344
==23247==    at 0x997EE83: g_type_create_instance (gtype.c:1845)
==23247==    by 0x99616C7: g_object_new_internal (gobject.c:1799)
==23247==    by 0x9962E14: g_object_new_with_properties (gobject.c:1967)
==23247==    by 0x99639D0: g_object_new (gobject.c:1639)
==23247==    by 0x21C73CE2: tooltip_menu_init (tooltipmenu.c:139)
==23247==    by 0x997EF39: g_type_create_instance (gtype.c:1866)
==23247==    by 0x99616C7: g_object_new_internal (gobject.c:1799)
==23247==    by 0x9962E14: g_object_new_with_properties (gobject.c:1967)
==23247==    by 0x99639D0: g_object_new (gobject.c:1639)
==23247==    by 0x21C73DF7: tooltip_menu_new (tooltipmenu.c:172)
==23247==    by 0x21C71FF1: otr_add_buddy_top_menu (gtk-dialog.c:2595)
==23247==    by 0x21C723D4: otr_add_buddy_top_menus (gtk-dialog.c:2697)

==23247== 184 (88 direct, 96 indirect) bytes in 1 blocks are definitely lost in loss record 15,861 of 17,344
==23247==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23247==    by 0x9BF03C5: g_malloc (gmem.c:99)
==23247==    by 0x9C07FF6: g_slice_alloc (gslice.c:1025)
==23247==    by 0x9BD89E1: g_hash_table_new_full (ghash.c:717)
==23247==    by 0x21C612F5: otrng_plugin_fingerprint_store_create (plugin-all.c:218)
==23247==    by 0x21C65907: otrng_plugin_init_userstate (plugin-all.c:2032)
==23247==    by 0x21C66014: otrng_plugin_load (plugin-all.c:2249)
==23247==    by 0x7E27592: purple_plugin_load (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x7E28696: purple_plugins_load_saved (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x143832: main (gtkmain.c:852)

==23247== 384 bytes in 6 blocks are possibly lost in loss record 16,436 of 17,344
==23247==    at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==23247==    by 0x9BF03C5: g_malloc (gmem.c:99)
==23247==    by 0x9C09D6F: g_memdup (gstrfuncs.c:391)
==23247==    by 0x9BD8334: g_hash_table_insert_node (ghash.c:970)
==23247==    by 0x9BD893C: g_hash_table_insert_internal (ghash.c:1235)
==23247==    by 0x5EA7268: gtk_tooltips_set_tip (gtktooltips.c:270)
==23247==    by 0x21C7422D: tooltip_menu_set_tooltip (tooltipmenu.c:231)
==23247==    by 0x21C7406F: tooltip_menu_add (tooltipmenu.c:193)
==23247==    by 0x21C74196: tooltip_menu_prepend (tooltipmenu.c:209)
==23247==    by 0x21C720C9: otr_add_buddy_top_menu (gtk-dialog.c:2603)
==23247==    by 0x21C723D4: otr_add_buddy_top_menus (gtk-dialog.c:2697)
==23247==    by 0x21C6E400: dialog_update_label_conv (gtk-dialog.c:1299)

==23247== 672 (304 direct, 368 indirect) bytes in 1 blocks are definitely lost in loss record 16,693 of 17,344
==23247==    at 0x997EE17: g_type_create_instance (gtype.c:1845)
==23247==    by 0x99616C7: g_object_new_internal (gobject.c:1799)
==23247==    by 0x9962E14: g_object_new_with_properties (gobject.c:1967)
==23247==    by 0x99639D0: g_object_new (gobject.c:1639)
==23247==    by 0x21C72E3D: otrng_gtk_dialog_new_purple_conv (gtk-dialog.c:2956)
==23247==    by 0x21C72620: conversation_switched (gtk-dialog.c:2760)
==23247==    by 0x7E3BCF1: purple_signal_emit_vargs (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x7E3BE61: purple_signal_emit (in /usr/lib64/libpurple.so.0.13.0)
==23247==    by 0x995BADC: g_closure_invoke (gclosure.c:804)
==23247==    by 0x996EA3D: signal_emit_unlocked_R (gsignal.c:3705)
==23247==    by 0x9978069: g_signal_emit_valist (gsignal.c:3391)
==23247==    by 0x9978662: g_signal_emit (gsignal.c:3447)
olabini commented 5 years ago

I think all these memory leaks are irrelevant since there's been so many changes here. However, I should run a new memory leak test and see what we get from that.

claucece commented 5 years ago

Thanks @olabini I do also think I fixed some of them.

olabini commented 5 years ago

I'm sure you have.