Free keys lists in windows.c

This commit is contained in:
James Booth
2014-06-17 23:14:54 +01:00
parent ecedca8a95
commit ad68bcfde2

View File

@@ -111,9 +111,11 @@ wins_get_next(void)
// if there is a next window return it // if there is a next window return it
curr = g_list_next(curr); curr = g_list_next(curr);
if (curr != NULL) { if (curr != NULL) {
g_list_free(keys);
return wins_get_by_num(GPOINTER_TO_INT(curr->data)); return wins_get_by_num(GPOINTER_TO_INT(curr->data));
// otherwise return the first window (console) // otherwise return the first window (console)
} else { } else {
g_list_free(keys);
return wins_get_console(); return wins_get_console();
} }
} }
@@ -137,10 +139,12 @@ wins_get_previous(void)
// if there is a previous window return it // if there is a previous window return it
curr = g_list_previous(curr); curr = g_list_previous(curr);
if (curr != NULL) { if (curr != NULL) {
g_list_free(keys);
return wins_get_by_num(GPOINTER_TO_INT(curr->data)); return wins_get_by_num(GPOINTER_TO_INT(curr->data));
// otherwise return the last window // otherwise return the last window
} else { } else {
int new_num = GPOINTER_TO_INT(g_list_last(keys)->data); int new_num = GPOINTER_TO_INT(g_list_last(keys)->data);
g_list_free(keys);
return wins_get_by_num(new_num); return wins_get_by_num(new_num);
} }
} }
@@ -280,6 +284,7 @@ wins_resize_all(void)
wresize(window->win, PAD_SIZE, cols); wresize(window->win, PAD_SIZE, cols);
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(values);
} }
ProfWin *current_win = wins_get_current(); ProfWin *current_win = wins_get_current();
@@ -295,11 +300,14 @@ wins_duck_exists(void)
while (curr != NULL) { while (curr != NULL) {
ProfWin *window = curr->data; ProfWin *window = curr->data;
if (window->type == WIN_DUCK) if (window->type == WIN_DUCK) {
g_list_free(values);
return TRUE; return TRUE;
}
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(values);
return FALSE; return FALSE;
} }
@@ -330,11 +338,14 @@ wins_get_xmlconsole(void)
while (curr != NULL) { while (curr != NULL) {
ProfWin *window = curr->data; ProfWin *window = curr->data;
if (window->type == WIN_XML) if (window->type == WIN_XML) {
g_list_free(values);
return window; return window;
}
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(values);
return NULL; return NULL;
} }
@@ -370,6 +381,7 @@ wins_get_prune_recipients(void)
} }
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(values);
return result; return result;
} }
@@ -394,6 +406,7 @@ wins_lost_connection(void)
} }
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(values);
} }
gboolean gboolean
@@ -496,8 +509,10 @@ wins_tidy(void)
windows = new_windows; windows = new_windows;
current = 1; current = 1;
ui_switch_win(1); ui_switch_win(1);
g_list_free(keys);
return TRUE; return TRUE;
} else { } else {
g_list_free(keys);
return FALSE; return FALSE;
} }
} }
@@ -607,6 +622,7 @@ wins_create_summary(void)
curr = g_list_next(curr); curr = g_list_next(curr);
} }
g_list_free(keys);
return result; return result;
} }