grim/pidgin

Fix leaks in preferences window

16 months ago, Elliott Sales de Andrade
bc9f3f1dd14b
Parents b8f686f4d43a
Children 27c84f0b3258
Fix leaks in preferences window

This fixes two leaks (of various amounts):
```
90 bytes in 5 blocks are definitely lost in loss record 27,394 of 41,972
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4980168: g_malloc (gmem.c:130)
by 0x4995602: g_strdup (gstrfuncs.c:363)
by 0x4DE1EEC: value_lcopy_string.lto_priv.0 (gvaluetypes.c:315)
by 0x4DC7F13: g_object_get_valist (gobject.c:2893)
by 0x4DC8243: g_object_get (gobject.c:2988)
by 0x4CF53A1: purple_media_element_info_get_name (mediamanager.c:2404)
by 0x48BE32A: populate_vv_device_menuitems (pidginvvprefs.c:87)
by 0x48BF440: bind_vv_dropdown (pidginvvprefs.c:443)
by 0x48BF48B: bind_vv_frame (pidginvvprefs.c:454)
by 0x48BFA7F: pidgin_vv_prefs_init (pidginvvprefs.c:574)
by 0x4DDF0E7: g_type_create_instance (gtype.c:1931)
```
```
121 bytes in 5 blocks are definitely lost in loss record 31,627 of 41,972
at 0x484386F: malloc (vg_replace_malloc.c:393)
by 0x4980168: g_malloc (gmem.c:130)
by 0x4995602: g_strdup (gstrfuncs.c:363)
by 0x4DE1EEC: value_lcopy_string.lto_priv.0 (gvaluetypes.c:315)
by 0x4DC7F13: g_object_get_valist (gobject.c:2893)
by 0x4DC8243: g_object_get (gobject.c:2988)
by 0x4CF5334: purple_media_element_info_get_id (mediamanager.c:2395)
by 0x48BE33A: populate_vv_device_menuitems (pidginvvprefs.c:88)
by 0x48BF440: bind_vv_dropdown (pidginvvprefs.c:443)
by 0x48BF48B: bind_vv_frame (pidginvvprefs.c:454)
by 0x48BFA7F: pidgin_vv_prefs_init (pidginvvprefs.c:574)
by 0x4DDF0E7: g_type_create_instance (gtype.c:1931)
```

Testing Done:
Ran with valgrind, opened the Preferences window, and the leaks were gone.

Reviewed at https://reviews.imfreedom.org/r/2303/
--- a/pidgin/prefs/pidginvvprefs.c Tue Feb 28 03:30:32 2023 -0600
+++ b/pidgin/prefs/pidginvvprefs.c Thu Mar 02 23:57:17 2023 -0600
@@ -82,7 +82,7 @@
for (; devices; devices = g_list_delete_link(devices, devices)) {
PurpleMediaElementInfo *info = devices->data;
GtkTreeIter iter;
- const gchar *name, *id;
+ char *name, *id;
name = purple_media_element_info_get_name(info);
id = purple_media_element_info_get_id(info);
@@ -91,6 +91,8 @@
gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_TEXT, name,
PIDGIN_PREF_COMBO_VALUE, id, -1);
+ g_free(name);
+ g_free(id);
g_object_unref(info);
}
}