mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
glocalfile: Fix leak of FS type on some platforms
fstype is a const char*, and is passed to g_file_info_set_attribute_string(), which takes a copy of it. There’s no need to g_strdup() the FS type from various statfs/statvfs buffers beforehand, given that the buffers are valid for the duration of this function. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=679347
This commit is contained in:
parent
c64b6da33c
commit
d4f07f21fb
@ -1106,16 +1106,16 @@ g_local_file_query_filesystem_info (GFile *file,
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
#ifdef USE_STATFS
|
#ifdef USE_STATFS
|
||||||
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME)
|
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME)
|
||||||
fstype = g_strdup (statfs_buffer.f_fstypename);
|
fstype = statfs_buffer.f_fstypename;
|
||||||
#else
|
#else
|
||||||
fstype = get_fs_type (statfs_buffer.f_type);
|
fstype = get_fs_type (statfs_buffer.f_type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(USE_STATVFS)
|
#elif defined(USE_STATVFS)
|
||||||
#if defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
|
#if defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
|
||||||
fstype = g_strdup (statfs_buffer.f_fstypename);
|
fstype = statfs_buffer.f_fstypename;
|
||||||
#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE)
|
#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE)
|
||||||
fstype = g_strdup (statfs_buffer.f_basetype);
|
fstype = statfs_buffer.f_basetype;
|
||||||
#else
|
#else
|
||||||
fstype = NULL;
|
fstype = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user