Skip to content

Fix leak of reason messages from libSM

Description

libSM sometimes calls malloc(0), which can return NULL or a pointer to be freed.

Leak report

Direct leak of 6 byte(s) in 6 object(s) allocated from:
    #0 0x7f0844afd891 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7f0842fba437 in _SmsProcessMessage libsm/src/sm_process.c:867
    #2 0x7f083ff48ed7 in IceProcessMessages libice/src/process.c:378
    #3 0x5ddb71cbb6b8 in ice_process_messages xfce4-session/ice-layer.c:113
    #4 0x7f08409f52de in g_io_unix_dispatch glib/giounix.c:170
    #5 0x7f084088ed06 in g_main_dispatch glib/gmain.c:3357
    #6 0x7f084088ed06 in g_main_context_dispatch_unlocked glib/gmain.c:4208
    #7 0x7f084089ba5a in g_main_context_iterate_unlocked glib/gmain.c:4273
    #8 0x7f084089d1be in g_main_loop_run glib/gmain.c:4475
    #9 0x7f08435f7bd6 in gtk_main gtk/gtkmain.c:1329
    #10 0x5ddb71c8e981 in main xfce4-session/main.c:398

References

Testing

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

Merge request reports