From ba6222a75bb28751cb57b65025bd2bfa40a91f84 Mon Sep 17 00:00:00 2001 From: wangxiaomeng Date: Fri, 12 Jan 2024 15:24:03 +0800 Subject: [PATCH] Modify memory-leaks patch errors --- ...ix-memory-leaks-detected-by-valgrind.patch | 50 +++++++++---------- gvfs.spec | 6 ++- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/0001-Fix-memory-leaks-detected-by-valgrind.patch b/0001-Fix-memory-leaks-detected-by-valgrind.patch index b6ff436..1faac57 100644 --- a/0001-Fix-memory-leaks-detected-by-valgrind.patch +++ b/0001-Fix-memory-leaks-detected-by-valgrind.patch @@ -1,32 +1,36 @@ -From e3b401e8dfd6bfb668113fe0095a3e05566df068 Mon Sep 17 00:00:00 2001 -From: houlifei -Date: Thu, 20 Jul 2023 17:49:16 +0800 -Subject: [PATCH] Fix memory leaks detected by valgrind +From a59a04e16edfe0cbd11f5b9ab2a8242ff7f8a63b Mon Sep 17 00:00:00 2001 +From: wang xiaomeng +Date: Tue, 18 Jul 2023 09:04:19 +0000 +Subject: [PATCH] Fix various memory leaks +Valgrind detects various memory leaks in gvfs daemons. Let's fix some of them. + +Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/682 --- - common/gvfsmountinfo.c | 1 + - daemon/gvfsbackendnetwork.c | 10 ++-------- - daemon/gvfsdaemon.c | 3 +++ - monitor/gphoto2/ggphoto2volumemonitor.c | 1 + - 4 files changed, 7 insertions(+), 8 deletions(-) + common/gvfsmountinfo.c | 2 +- + daemon/gvfsbackendnetwork.c | 9 +-------- + daemon/gvfsdaemon.c | 3 +++ + monitor/gphoto2/ggphoto2volumemonitor.c | 1 + + 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/common/gvfsmountinfo.c b/common/gvfsmountinfo.c -index c3f31af..34a5450 100644 +index c3f31af..287b9db 100644 --- a/common/gvfsmountinfo.c +++ b/common/gvfsmountinfo.c -@@ -641,6 +641,7 @@ _g_find_file_insensitive_async (GFile *parent, +@@ -640,7 +640,7 @@ _g_find_file_insensitive_async (GFile *parent, + G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, cancellable, find_file_insensitive_exists_callback, task); - -+ g_object_unref (direct_file); //uos add for fixing memory leaks +- ++ g_object_unref (direct_file); } diff --git a/daemon/gvfsbackendnetwork.c b/daemon/gvfsbackendnetwork.c -index 87cfec7..9f1905b 100644 +index ad9d68e..68c2097 100644 --- a/daemon/gvfsbackendnetwork.c +++ b/daemon/gvfsbackendnetwork.c -@@ -902,19 +902,13 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) +@@ -901,14 +901,7 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) network_backend->smb_settings = g_settings_new ("org.gnome.system.smb"); current_workgroup = g_settings_get_string (network_backend->smb_settings, "workgroup"); @@ -42,35 +46,29 @@ index 87cfec7..9f1905b 100644 g_signal_connect (network_backend->smb_settings, "change-event", - G_CALLBACK (smb_settings_change_event_cb), - network_backend); -+ g_free (current_workgroup); // uos add for fixing memory leaks - } - - if (network_backend->have_dnssd) diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c -index a6d6236..72bdea1 100644 +index 0946f41..155d479 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c -@@ -145,6 +145,9 @@ g_vfs_daemon_finalize (GObject *object) +@@ -153,6 +153,9 @@ g_vfs_daemon_finalize (GObject *object) daemon = G_VFS_DAEMON (object); + if (daemon->thread_pool != NULL) -+ g_thread_pool_free (daemon->thread_pool, TRUE, TRUE); // uos add for fixing memory leaks ++ g_thread_pool_free (daemon->thread_pool, TRUE, FALSE); + /* There may be some jobs outstanding if we've been force unmounted. */ if (daemon->jobs) g_warning ("daemon->jobs != NULL when finalizing daemon!"); diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c -index 54dec6e..e689b41 100644 +index 54dec6e..77d458a 100644 --- a/monitor/gphoto2/ggphoto2volumemonitor.c +++ b/monitor/gphoto2/ggphoto2volumemonitor.c @@ -331,6 +331,7 @@ gudev_coldplug_cameras (GGPhoto2VolumeMonitor *monitor) if (g_udev_device_has_property (d, "ID_GPHOTO2")) gudev_add_camera (monitor, d, FALSE); } -+ g_list_free_full(usb_devices, g_object_unref); // uos add for fixing memory leaks ++ g_list_free_full (usb_devices, g_object_unref); } static GObject * diff --git a/gvfs.spec b/gvfs.spec index c6de6dc..42b5cec 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -23,12 +23,13 @@ Name: gvfs Version: 1.46.2 -Release: 5 +Release: 6 Summary: gvfs is a backends for the gio framework in GLib License: GPLv3 and LGPLv2+ and BSD and MPLv2.0 URL: https://wiki.gnome.org/Projects/gvfs Source0: https://download.gnome.org/sources/gvfs/1.46/gvfs-%{version}.tar.xz +# Modify memory leaks patch errors by backporting upstream patch Patch0: 0001-Fix-memory-leaks-detected-by-valgrind.patch Patch1: Ignore-EINVAL-for-kerberos-ccache-login.patch BuildRequires: /usr/bin/ssh git pkgconfig fuse3 @@ -228,6 +229,9 @@ killall -USR1 gvfsd >&/dev/null || : %{_mandir}/man1/gvfsd-fuse.1* %changelog +* Fri Jan 12 2024 wangxiaomeng - 1.46.2-6 +- Modify memory-leaks patch errors + * Tue Dec 05 2023 lwg - 1.46.2-5 - Remove rpath -- Gitee