[glib] glocalfile: Fix leak of FS type on some platforms



commit d4f07f21fbb346588e17c96fad045fb8ec6f5afd
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Nov 15 13:08:11 2017 +0000

    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

 gio/glocalfile.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 806b547..e484a31 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -1106,16 +1106,16 @@ g_local_file_query_filesystem_info (GFile         *file,
 #ifndef G_OS_WIN32
 #ifdef USE_STATFS
 #if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME)
-  fstype = g_strdup (statfs_buffer.f_fstypename);
+  fstype = statfs_buffer.f_fstypename;
 #else
   fstype = get_fs_type (statfs_buffer.f_type);
 #endif
 
 #elif defined(USE_STATVFS)
 #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)
-  fstype = g_strdup (statfs_buffer.f_basetype);
+  fstype = statfs_buffer.f_basetype;
 #else
   fstype = NULL;
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]