diff options
| author | Tomas Bzatek <tbzatek@redhat.com> | 2023-12-17 16:54:30 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@redhat.com> | 2023-12-17 16:54:30 +0100 |
| commit | 7592788feb1a8cb79b85e6a9911a206a5d55896d (patch) | |
| tree | 9351c4fbbaa9846d3a2dfc9b59cdb71ea0a90cbb /gvfs/gvfs.c | |
| parent | bc2840a47145db5668045e281c2a2bbce14b68f4 (diff) | |
| download | tuxcmd-modules-7592788feb1a8cb79b85e6a9911a206a5d55896d.tar.xz | |
GVFS: Fix leaking GFileInfo
Diffstat (limited to 'gvfs/gvfs.c')
| -rw-r--r-- | gvfs/gvfs.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index e50bdb0..69550b6 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -367,9 +367,14 @@ VFSOpenURI (struct TVFSGlobs *globs, const char *sURI, GError **error) local_error = NULL; info = g_file_query_info (f, CONST_DEFAULT_QUERY_INFO_ATTRIBUTES, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &local_error); + if (info) { + /* everything ok */ + g_object_unref (info); + break; + } /* Fallback to parent directory if specified path doesn't exist */ - if (local_error && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { + if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { f2 = g_file_get_parent (f); if (f2) { g_object_unref (f); @@ -379,7 +384,7 @@ VFSOpenURI (struct TVFSGlobs *globs, const char *sURI, GError **error) } } /* Mount the target */ - if (local_error && g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED)) { + if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED)) { g_error_free (local_error); local_error = vfs_handle_mount (globs, f); if (local_error != NULL) { @@ -389,15 +394,12 @@ VFSOpenURI (struct TVFSGlobs *globs, const char *sURI, GError **error) else continue; } - /* Any other errors --> report */ - if (local_error) { - g_print ("(EE) VFSOpenURI: g_file_query_info() error: %s\n", local_error->message); - g_propagate_error (error, local_error); - g_object_unref (f); - return FALSE; - } - /* everything ok? */ - break; + + /* Any other error --> report */ + g_print ("(EE) VFSOpenURI: g_file_query_info() error: %s\n", local_error->message); + g_propagate_error (error, local_error); + g_object_unref (f); + return FALSE; } globs->file = f; |
