Fix a read-after-free (as detected by Valgrind):

Go to the next element in the recent cf list before freeing the current
element.

svn path=/trunk/; revision=45026
This commit is contained in:
Jeff Morriss 2012-09-20 16:37:29 +00:00
parent 79171ea7ef
commit be3c572d4f
1 changed files with 5 additions and 1 deletions

View File

@ -4295,8 +4295,12 @@ add_menu_recent_capture_file_absolute(gchar *cf_name) {
}
recent_files_list = g_object_get_data(G_OBJECT(submenu_recent_files), "recent-files-list");
cnt = 1;
for (li = g_list_first(recent_files_list); li; li = li->next, cnt++) {
for (li = g_list_first(recent_files_list); li; cnt++) {
widget_cf_name = li->data;
/* Find the next element BEFORE we (possibly) free the current one below */
li = li->next;
if (
#ifdef _WIN32
/* do a case insensitive compare on win32 */