Fix error-path leaks in xfce-desktop-item-edit main
Leak report
Direct leak of 72 byte(s) in 1 object(s) allocated from:
#0 0x7fcb1ef7335d in calloc
#1 0x7fcb1d997dba in g_malloc0 glib/glib/gmem.c:133:13
#2 0x7fcb1d93dbf0 in g_key_file_new glib/glib/gkeyfile.c:705:14
#3 0x55bd91a76581 in main libxfce4ui/xfce-desktop-item-edit/main.c:238:14
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7fcb1ef7335d in calloc
#1 0x7fcb1d997dba in g_malloc0 glib/glib/gmem.c:133:13
#2 0x7fcb1dd877f0 in g_type_create_instance glib/gobject/gtype.c:1882:17
#3 0x7fcb1dd26205 in g_object_new_internal glib/gobject/gobject.c:2664:24
#4 0x7fcb1dd2429b in g_object_new_with_properties glib/gobject/gobject.c:2826:14
#5 0x7fcb1dd2429b in g_object_new glib/gobject/gobject.c:2475:12
#6 0x7fcb1e8b7eec in _g_local_file_new glib/gio/glocalfile.c:233:11
#7 0x7fcb1e8ddb29 in g_local_vfs_get_file_for_path glib/gio/glocalvfs.c:88:12
#8 0x7fcb1e6db9c4 in g_vfs_get_file_for_path glib/gio/gvfs.c:165:10
#9 0x7fcb173b524b in g_daemon_vfs_get_file_for_path gvfs/client/gdaemonvfs.c:383:10
#10 0x7fcb1e6db9c4 in g_vfs_get_file_for_path glib/gio/gvfs.c:165:10
#11 0x7fcb1e567d9f in g_file_new_for_path glib/gio/gfile.c:7222:10
#12 0x7fcb1e567d9f in new_for_cmdline_arg glib/gio/gfile.c:7658:12
#13 0x7fcb1e567d4f in g_file_new_for_commandline_arg glib/gio/gfile.c:7707:10
#14 0x55bd91a761df in main libxfce4ui/xfce-desktop-item-edit/main.c:223:11
Steps to reproduce
- The "no type key" path
xfce-desktop-item-edit /usr/lib/gnome-settings-daemon-3.0/gtk-modules/at-spi2-atk.desktop
- The "Unsupported desktop file type" path
xfce-desktop-item-edit /usr/local/share/xfce4/helpers/clementine.desktop
Testing
- No issues were detected when testing the patch with UBSan, LSan, and ASan