Tue, 07 Feb 2023 00:55:49 -0600
fix memory leak originating in purple_prefs_connect_callback
Testing Done:
This leak happened just by starting and closing Pidgin. So I started and closed Pidgin and the leak didn't happen anymore.
Example valgrind output of the leak:
```
==425973== 21 bytes in 1 blocks are definitely lost in loss record 3,984 of 17,678
==425973== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==425973== by 0x54CF738: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==425973== by 0x54E4583: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7200.4)
==425973== by 0x5796FBE: purple_prefs_connect_callback (prefs.c:1425)
==425973== by 0x17DF74: setup_menubar (gtkconv.c:3573)
==425973== by 0x18F25F: pidgin_conv_window_new (gtkconv.c:9477)
==425973== by 0x18BAAF: pidgin_conversations_init (gtkconv.c:8193)
==425973== by 0x1BE505: pidgin_ui_init (gtkmain.c:328)
==425973== by 0x57607F9: purple_core_init (core.c:188)
==425973== by 0x1BF5C3: main (gtkmain.c:826)
```
Reviewed at https://reviews.imfreedom.org/r/2226/
| libpurple/prefs.c | file | annotate | diff | comparison | revisions |
--- a/libpurple/prefs.c Tue Feb 07 00:55:16 2023 -0600 +++ b/libpurple/prefs.c Tue Feb 07 00:55:49 2023 -0600 @@ -759,6 +759,7 @@ struct purple_pref *child = NULL, *next = NULL; char *name; GSList *l; + PurplePrefCallbackData *cb; if(!pref) return; @@ -793,7 +794,9 @@ while((l = pref->callbacks) != NULL) { pref->callbacks = pref->callbacks->next; - g_free(l->data); + cb = l->data; + g_free(cb->name); + g_free(cb); g_slist_free_1(l); } g_free(pref->name);