Skip to content

screen: Fix gtk_container_get_children leaks

Leak report

Indirect leak of 72 byte(s) in 3 object(s) allocated from:
    #0 0x63f906cc69e9 in malloc (/usr/asan/bin/xfce4-terminal+0x2069e9)
    #1 0x7516c380904a in g_malloc /usr/src/debug/glib2/build/../glib/glib/gmem.c:100:13
    #2 0x7516c37fdacb in g_list_prepend /usr/src/debug/glib2/build/../glib/glib/glist.c:253:14
    #3 0x7516c44ec1f5 in gtk_container_children_callback gtk/gtkcontainer.c:3311:15
    #4 0x7516c4441117 in gtk_box_forall gtk/gtkbox.c:2678:2
    #5 0x7516c44ec131 in gtk_container_foreach gtk/gtkcontainer.c:2479:5
    #6 0x7516c44ec131 in gtk_container_get_children gtk/gtkcontainer.c:2543:3
    #7 0x63f906d72616 in terminal_screen_paste_unsafe_text xfce4-terminal/terminal/terminal-screen.c:1913:30
    #8 0x63f906d71c38 in terminal_screen_paste_clipboard xfce4-terminal/terminal/terminal-screen.c:2531:5
    #9 0x63f906dc6c6b in terminal_window_action_paste xfce4-terminal/terminal/terminal-window.c:1735:5
[...snip...]

Indirect leak of 72 byte(s) in 3 object(s) allocated from:
    #0 0x63f906cc69e9 in malloc (/usr/asan/bin/xfce4-terminal+0x2069e9)
    #1 0x7516c380904a in g_malloc /usr/src/debug/glib2/build/../glib/glib/gmem.c:100:13
    #2 0x7516c37fdacb in g_list_prepend /usr/src/debug/glib2/build/../glib/glib/glist.c:253:14
    #3 0x7516c44ec1f5 in gtk_container_children_callback gtk/gtkcontainer.c:3311:15
    #4 0x7516c4441117 in gtk_box_forall gtk/gtkbox.c:2678:2
    #5 0x7516c44ec131 in gtk_container_foreach gtk/gtkcontainer.c:2479:5
    #6 0x7516c44ec131 in gtk_container_get_children gtk/gtkcontainer.c:2543:3
    #7 0x63f906d72444 in terminal_screen_paste_unsafe_text xfce4-terminal/terminal/terminal-screen.c:1910:27
    #8 0x63f906d71c38 in terminal_screen_paste_clipboard xfce4-terminal/terminal/terminal-screen.c:2531:5
    #9 0x63f906dc6c6b in terminal_window_action_paste xfce4-terminal/terminal/terminal-window.c:1735:5
[...snip...]

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x63f906cc69e9 in malloc (/usr/asan/bin/xfce4-terminal+0x2069e9)
    #1 0x7516c380904a in g_malloc /usr/src/debug/glib2/build/../glib/glib/gmem.c:100:13
    #2 0x7516c37fdacb in g_list_prepend /usr/src/debug/glib2/build/../glib/glib/glist.c:253:14
    #3 0x7516c44ec1f5 in gtk_container_children_callback gtk/gtkcontainer.c:3311:15
    #4 0x7516c444121e in gtk_box_forall gtk/gtkbox.c:2694:2
    #5 0x7516c44ec131 in gtk_container_foreach gtk/gtkcontainer.c:2479:5
    #6 0x7516c44ec131 in gtk_container_get_children gtk/gtkcontainer.c:2543:3
    #7 0x63f906d72376 in terminal_screen_paste_unsafe_text xfce4-terminal/terminal/terminal-screen.c:1909:30
    #8 0x63f906d71c38 in terminal_screen_paste_clipboard xfce4-terminal/terminal/terminal-screen.c:2531:5
    #9 0x63f906dc6c6b in terminal_window_action_paste xfce4-terminal/terminal/terminal-window.c:1735:5
[...snip...]

Steps to reproduce

  • Enable "Show unsafe paste dialog" in Edit > Preferences
  • Paste two lines of text into the terminal
  • Click the Paste button in the unsafe paste dialog

Testing

  • No issues were detected with LSan, ASan, or Valgrind when testing the patch

Merge request reports

Loading