diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2012-07-27 16:03:48 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2012-07-31 11:59:38 +0200 |
commit | 59cda52b8d5e067c4fbdab1943fc90859ed0b97f (patch) | |
tree | 099f4cd80ca0c9d1669be38612eb4e8b252e6dee /client/gvfsiconloadable.c | |
parent | 6184b93b66d37ac101582eafb4dd39646811f54d (diff) | |
download | gvfs-59cda52b8d5e067c4fbdab1943fc90859ed0b97f.tar.gz |
gdbus: Don't use NULL values on error with fd passing
Found out that if the remote call fails, some variables are left
uninitialized and causes assertion failures while we don't need them.
Diffstat (limited to 'client/gvfsiconloadable.c')
-rw-r--r-- | client/gvfsiconloadable.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c index 511090d8..70ee720b 100644 --- a/client/gvfsiconloadable.c +++ b/client/gvfsiconloadable.c @@ -93,8 +93,7 @@ g_vfs_icon_load (GLoadableIcon *icon, gboolean can_seek; GUnixFDList *fd_list; int fd; - GVariant *fd_id_val; - guint32 fd_id; + GVariant *fd_id_val = NULL; GError *local_error = NULL; g_print ("gvfsiconloadable.c: g_vfs_icon_load\n"); @@ -114,9 +113,6 @@ g_vfs_icon_load (GLoadableIcon *icon, g_print ("gvfsiconloadable.c: g_vfs_icon_load: done, res = %d\n", res); - fd_id = g_variant_get_handle (fd_id_val); - g_variant_unref (fd_id_val); - if (! res) { if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -129,14 +125,16 @@ g_vfs_icon_load (GLoadableIcon *icon, if (! res) return NULL; - if (fd_list == NULL || g_unix_fd_list_get_length (fd_list) != 1 || - (fd = g_unix_fd_list_get (fd_list, 0, NULL)) == -1) + if (fd_list == NULL || fd_id_val == NULL || + g_unix_fd_list_get_length (fd_list) != 1 || + (fd = g_unix_fd_list_get (fd_list, g_variant_get_handle (fd_id_val), NULL)) == -1) { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); return NULL; } + g_variant_unref (fd_id_val); g_object_unref (fd_list); return G_INPUT_STREAM (g_daemon_file_input_stream_new (fd, can_seek)); |