Skip to content

Commit 4d81f83

Browse files
authored
housekeeping: fix list iteration and memleak in ldsm-dialog (#431)
Even if this dialog is likely never shown, fix the list iteration and memory leak when handling the ignore-paths setting. This will address the (justified) gcc warning regarding the wrong use of G_N_ELEMENTS on the strv.
1 parent 71cfccb commit 4d81f83

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/housekeeping/csd-ldsm-dialog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
158158

159159
settings_list = g_settings_get_strv (settings, "ignore-paths");
160160

161-
for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
161+
for (i = 0; i < g_strv_length (settings_list); i++) {
162162
if (settings_list[i] != NULL)
163163
ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
164164
}
@@ -180,7 +180,7 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
180180
g_warning ("Cannot change ignore preference - failed to commit changes");
181181
}
182182

183-
g_ptr_array_free (array, FALSE);
183+
g_ptr_array_free (array, TRUE);
184184
}
185185

186186
g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);

0 commit comments

Comments
 (0)