From 7baf84f22bcf68f0c4a14a5ff404119aafe2666a Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 4 Oct 2009 16:30:10 +0200 Subject: Consolidate VFS memory management --- gvfs/gvfs.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'gvfs') diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index 0e9204a..1fb0230 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -339,29 +339,30 @@ VFSVersion () return cVFSVersion; } -struct TVFSInfo +struct TVFSInfo * VFSGetInfo () { - struct TVFSInfo module_info; + struct TVFSInfo *module_info = g_malloc0 (sizeof (struct TVFSInfo)); + + module_info->ID = g_strdup ("gvfs_plugin"); + module_info->Name = g_strdup ("GVFS plugin"); + module_info->About = g_strdup_printf ("version %s, build date: %s", VERSION, BUILD_DATE); + module_info->Copyright = g_strdup ("Copyright (C) 2008-2009 Tomáš Bžatek"); - module_info.ID = "gvfs_plugin"; - module_info.Name = "GVFS plugin"; - module_info.About = g_strdup_printf ("version %s, build date: %s", VERSION, BUILD_DATE); - module_info.Copyright = "Copyright (C) 2008-2009 Tomáš Bžatek"; return module_info; } char * VFSGetExts () { - return ""; + return NULL; } char * VFSGetServices () { /* FIXME: retrieve list of supported backends from gvfs subsystem */ - return "http;https;ftp;sftp;smb;network"; + return g_strdup ("http;https;ftp;sftp;smb;network"); } char * @@ -463,8 +464,10 @@ VFSGetPath (struct TVFSGlobs *globs) if (root == NULL) return NULL; path = g_file_get_relative_path (root, globs->file); - if (path == NULL) + if (path == NULL) { + g_object_unref (root); return NULL; + } if (! g_path_is_absolute (path)) s = g_strdup_printf ("/%s", path); else @@ -481,9 +484,8 @@ VFSGetPath (struct TVFSGlobs *globs) char * VFSGetPathURI (struct TVFSGlobs *globs) { - if (globs->file) { + if (globs->file) return g_file_get_uri (globs->file); - } else return NULL; } -- cgit v1.2.3