Fix memory leaks detected by valgrind
This commit is contained in:
parent
9f40098734
commit
3853aefaae
79
0001-Fix-memory-leaks-detected-by-valgrind.patch
Normal file
79
0001-Fix-memory-leaks-detected-by-valgrind.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From e3b401e8dfd6bfb668113fe0095a3e05566df068 Mon Sep 17 00:00:00 2001
|
||||
From: houlifei <houlifei@uniontech.com>
|
||||
Date: Thu, 20 Jul 2023 17:49:16 +0800
|
||||
Subject: [PATCH] Fix memory leaks detected by valgrind
|
||||
|
||||
---
|
||||
common/gvfsmountinfo.c | 1 +
|
||||
daemon/gvfsbackendnetwork.c | 10 ++--------
|
||||
daemon/gvfsdaemon.c | 3 +++
|
||||
monitor/gphoto2/ggphoto2volumemonitor.c | 1 +
|
||||
4 files changed, 7 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/common/gvfsmountinfo.c b/common/gvfsmountinfo.c
|
||||
index c3f31af..34a5450 100644
|
||||
--- a/common/gvfsmountinfo.c
|
||||
+++ b/common/gvfsmountinfo.c
|
||||
@@ -641,6 +641,7 @@ _g_find_file_insensitive_async (GFile *parent,
|
||||
cancellable,
|
||||
find_file_insensitive_exists_callback, task);
|
||||
|
||||
+ g_object_unref (direct_file); //uos add for fixing memory leaks
|
||||
|
||||
}
|
||||
|
||||
diff --git a/daemon/gvfsbackendnetwork.c b/daemon/gvfsbackendnetwork.c
|
||||
index 87cfec7..9f1905b 100644
|
||||
--- a/daemon/gvfsbackendnetwork.c
|
||||
+++ b/daemon/gvfsbackendnetwork.c
|
||||
@@ -902,19 +902,13 @@ 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");
|
||||
-
|
||||
- if (current_workgroup == NULL ||
|
||||
- current_workgroup[0] == 0)
|
||||
- /* it's okay if current_workgroup is null here,
|
||||
- * it's checked before the NetworkFile is added anyway. */
|
||||
- network_backend->current_workgroup = NULL;
|
||||
- else
|
||||
- network_backend->current_workgroup = current_workgroup;
|
||||
+ network_backend->current_workgroup = current_workgroup;
|
||||
|
||||
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
|
||||
--- a/daemon/gvfsdaemon.c
|
||||
+++ b/daemon/gvfsdaemon.c
|
||||
@@ -145,6 +145,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
|
||||
+
|
||||
/* 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
|
||||
--- 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
|
||||
}
|
||||
|
||||
static GObject *
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -22,13 +22,17 @@
|
||||
|
||||
Name: gvfs
|
||||
Version: 1.50.2
|
||||
Release: 4
|
||||
Release: 5
|
||||
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.50/gvfs-%{version}.tar.xz
|
||||
|
||||
|
||||
# Fix memory leaks detected by valgrind
|
||||
Patch01: 0001-Fix-memory-leaks-detected-by-valgrind.patch
|
||||
|
||||
BuildRequires: /usr/bin/ssh meson gcc libexif-devel gettext-devel docbook-style-xsl chrpath
|
||||
BuildRequires: pkgconfig(dbus-1)
|
||||
BuildRequires: pkgconfig(gcr-3)
|
||||
@ -169,6 +173,9 @@ killall -USR1 gvfsd >&/dev/null || :
|
||||
%{_mandir}/man1/gvfsd-fuse.1*
|
||||
|
||||
%changelog
|
||||
* Thu Jul 20 2023 houlifei <houlifei@uniontech.com> - 1.50.2-5
|
||||
- Fix memory leaks detected by valgrind
|
||||
|
||||
* Wed Mar 22 2023 lin zhang <lin.zhang@turbolinux.com.cn> - 1.50.2-4
|
||||
- add library path file to /etc/ld.so.conf.d
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user