From cb70987407dbf50099666c49e840365adfe3c7a7 Mon Sep 17 00:00:00 2001 From: wangxiaomeng Date: Fri, 12 Jan 2024 15:10:26 +0800 Subject: [PATCH] Modify memory-leaks patch errors --- ...ix-memory-leaks-detected-by-valgrind.patch | 48 +++++++++---------- gvfs.spec | 7 ++- 2 files changed, 28 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..630a529 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 64581a94ceeb3f3d3121823fbd309a8c81c8b4fb 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 87cfec7..50cdc27 100644 --- a/daemon/gvfsbackendnetwork.c +++ b/daemon/gvfsbackendnetwork.c -@@ -902,19 +902,13 @@ g_vfs_backend_network_init (GVfsBackendNetwork *network_backend) +@@ -902,14 +902,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,14 +46,8 @@ 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 a6d6236..f659041 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c @@ -145,6 +145,9 @@ g_vfs_daemon_finalize (GObject *object) @@ -57,20 +55,20 @@ index a6d6236..72bdea1 100644 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 789a557..d9a513f 100644 --- a/gvfs.spec +++ b/gvfs.spec @@ -22,7 +22,7 @@ Name: gvfs Version: 1.50.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 @@ -30,7 +30,7 @@ URL: https://wiki.gnome.org/Projects/gvfs Source0: https://download.gnome.org/sources/gvfs/1.50/gvfs-%{version}.tar.xz -# Fix memory leaks detected by valgrind +# Modify memory leaks patch errors by backporting upstream patch Patch01: 0001-Fix-memory-leaks-detected-by-valgrind.patch BuildRequires: /usr/bin/ssh meson gcc libexif-devel gettext-devel docbook-style-xsl chrpath @@ -173,6 +173,9 @@ killall -USR1 gvfsd >&/dev/null || : %{_mandir}/man1/gvfsd-fuse.1* %changelog +* Fri Jan 12 2024 wangxiaomeng - 1.50.2-6 +- Modify memory-leaks patch errors + * Thu Jul 20 2023 houlifei - 1.50.2-5 - Fix memory leaks detected by valgrind -- Gitee