pidgin/pidgin

fix use after free
release-2.x.y
23 months ago, ivanhoe
6fe6bf9a695b
Parents e53e50de3444
Children 4e0059800ba9
fix use after free

This fixes an invalid read showing up in valgrind when opening some conversations in Pidgin and the closing Pidgin.
The code was introduced with /r/1342. It looks pretty straightforward so I hope I'm not messing with the fixes that were done in that RR.

Testing Done:
Started Pidgin in valgrind, opened some conversations and closed Pidgin again. No more invalid reads are shown.

Reviewed at https://reviews.imfreedom.org/r/1488/
--- a/pidgin/gtkconv.c Tue May 31 00:07:27 2022 -0500
+++ b/pidgin/gtkconv.c Thu Jun 02 20:15:50 2022 -0500
@@ -9806,9 +9806,6 @@
if (win->gtkconvs && win->gtkconvs->next == NULL)
pidgin_conv_tab_pack(win, win->gtkconvs->data);
- if (!win->gtkconvs && win != hidden_convwin)
- pidgin_conv_window_destroy(win);
-
for (gtkconvs = win->gtkconvs; gtkconvs != NULL; gtkconvs = gtkconvs->next) {
gtkconvs_data = gtkconvs->data;
if(gtkconvs_data != NULL) {
@@ -9816,6 +9813,9 @@
GINT_TO_POINTER(0));
}
}
+
+ if (!win->gtkconvs && win != hidden_convwin)
+ pidgin_conv_window_destroy(win);
}
PidginConversation *