[gnome-applets] sticky-notes: fix use after free



commit 92df027abbd5f6dfbe94431ecdf18cfef5de1254
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Mar 21 19:28:12 2021 +0200

    sticky-notes: fix use after free
    
    Coverity CID: #1502728

 gnome-applets/sticky-notes/sticky-notes-applet.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gnome-applets/sticky-notes/sticky-notes-applet.c 
b/gnome-applets/sticky-notes/sticky-notes-applet.c
index fe5cc65ed..74730ae71 100644
--- a/gnome-applets/sticky-notes/sticky-notes-applet.c
+++ b/gnome-applets/sticky-notes/sticky-notes-applet.c
@@ -112,11 +112,8 @@ destroy_all_response_cb (GtkDialog         *dialog,
                          StickyNotesApplet *applet)
 {
        if (id == GTK_RESPONSE_OK) {
-               while (g_list_length (applet->notes) > 0) {
-                       StickyNote *note = g_list_nth_data (applet->notes, 0);
-                       stickynote_free(note);
-                       applet->notes = g_list_remove (applet->notes, note);
-               }
+               g_list_free_full (applet->notes, (GDestroyNotify) stickynote_free);
+               applet->notes = NULL;
        }
 
        stickynotes_applet_update_tooltips (applet);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]