Skip to content

clock: Fix string leaks related to clock_time_strdup_strftime

Leak report

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7f39ccf72195 in realloc /usr/src/debug/compiler-rt/compiler-rt-20.1.6.src/lib/asan/asan_malloc_linux.cpp:81:3
    #1 0x7f39ccb98912 in g_realloc glib/glib/gmem.c:171:16
    #2 0x7f39ccc1f4d3 in g_string_expand glib/glib/gstring.c:78:17
    #3 0x7f39ccc1f1eb in g_string_sized_new glib/glib/gstring.c:113:3
    #4 0x7f39ccaf2483 in g_date_time_format glib/glib/gdatetime.c:3809:12
    #5 0x7b39affd273b in clock_time_strdup_strftime xfce4-panel/plugins/clock/clock-time.c:227:9
    #6 0x7b39affd052c in clock_plugin_validate_format_specifier xfce4-panel/plugins/clock/clock.c:838:8
    #7 0x7b39affcfc8f in clock_plugin_validate_entry_text xfce4-panel/plugins/clock/clock.c:852:3
    #8 0x7f39c9b1263b in g_cclosure_marshal_VOID__VOID glib/gobject/gmarshal.c:117:3
    #9 0x7f39c9b078f2 in g_closure_invoke glib/gobject/gclosure.c:916:7
    #10 0x7f39c9b79cad in signal_emit_unlocked_R glib/gobject/gsignal.c:3902:8
    #11 0x7f39c9b75672 in signal_emit_valist_unlocked glib/gobject/gsignal.c:3534:7
    #12 0x7f39c9b76e0b in g_signal_emit_by_name glib/gobject/gsignal.c:3638:11
    #13 0x7f39cbebc9a4 in end_change gtk/gtk/gtkentry.c:2953:12
    #14 0x7f39cbebc9a4 in gtk_entry_set_text gtk/gtk/gtkentry.c:7735:3
    #15 0x7b39affd07ca in clock_plugin_configure_plugin_chooser_changed xfce4-panel/plugins/clock/clock.c:802:11
[...snip...]

Steps to reproduce

  • The leak in clock_plugin_validate_format_specifier:
    • In clock options, choose a new time format from the dropdown
  • The leak in clock_time_strdup_strftime:
    • In clock options, set the custom time format to an empty string

Testing

  • No issues were detected when testing the patch with UBSan, LSan, and ASan

Merge request reports

Loading