Fix hyperlink-related leaks in terminal_widget_get_link
Leak report
Direct leak of 264 byte(s) in 1 object(s) allocated from:
#0 0x7f9404b72fc5 in malloc
#1 0x7f94036693ea in _pcre2_memctl_malloc_8 /usr/src/debug/pcre2/pcre2/src/pcre2_context.c:90:3
#2 0x7f94036ab50f in pcre2_match_data_create_8 /usr/src/debug/pcre2/pcre2/src/pcre2_match_data.c:63:9
#3 0x564add711c46 in terminal_widget_get_link xfce4-terminal/terminal/terminal-widget.c:1059:24
#4 0x564add7126ed in terminal_widget_context_menu xfce4-terminal/terminal/terminal-widget.c:475:10
[...snip...]
Direct leak of 12 byte(s) in 1 object(s) allocated from:
#0 0x7f9404b72fc5 in malloc
#1 0x7f9404797d52 in g_malloc glib/glib/gmem.c:100:13
#2 0x7f94048151e4 in g_strdup glib/glib/gstrfuncs.c:323:17
#3 0x7f94015034b8 in g_strdup_inline(char const*) /usr/local/include/glib-2.0/glib/gstrfuncs.h:321:10
#4 0x7f94015034b8 in vte::terminal::Terminal::hyperlink_check(long, long) vte/src/vte.cc:1767:16
#5 0x7f94015034b8 in vte::terminal::Terminal::hyperlink_check(vte::platform::MouseEvent const&) vte/src/vte.cc:1737:16
#6 0x7f940155e0d4 in vte::platform::Widget::hyperlink_check(_GdkEvent*) vte/src/widget.hh:584:36
#7 0x7f940155e0d4 in vte_terminal_hyperlink_check_event vte/src/vtegtk.cc:4141:34
#8 0x564add711b57 in terminal_widget_get_link xfce4-terminal/terminal/terminal-widget.c:1050:36
#9 0x564add7126ed in terminal_widget_context_menu xfce4-terminal/terminal/terminal-widget.c:475:10
[...snip...]
Steps to reproduce
- Right-click on the links from these commands:
printf '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\\n'printf '\e]8;;example.com\e\\This is a link\e]8;;\e\\\n'
Testing
- No issues were detected when testing the patch with UBSan, LSan, and ASan