[gnome-software] Do not dlclose modules when running under valgrind
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not dlclose modules when running under valgrind
- Date: Wed, 22 Feb 2017 19:36:42 +0000 (UTC)
commit 0e2e452aa010139eea7ef31a785e563bf9476e56
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 22 16:16:57 2017 +0000
Do not dlclose modules when running under valgrind
Without this patch, unloading the module means we can't resolve the symbols
where the memory was leaked.
configure.ac | 1 +
contrib/gnome-software.spec.in | 1 +
src/Makefile.am | 1 +
src/gs-plugin.c | 4 ++++
4 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4c146f8..9318183 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,7 @@ PKG_CHECK_MODULES(SQLITE, sqlite3)
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.51.92)
PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
PKG_CHECK_MODULES(LIBSECRET, libsecret-1)
+PKG_CHECK_MODULES(VALGRIND, valgrind)
AC_PATH_PROG(APPSTREAM_UTIL, [appstream-util], [unfound])
# use -lm
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index 64b626b..e168655 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -45,6 +45,7 @@ BuildRequires: flatpak-devel >= %{flatpak_version}
BuildRequires: ostree-devel
BuildRequires: rpm-devel
BuildRequires: libgudev1-devel
+BuildRequires: valgrind-devel
Requires: appstream-data
%if 0%{?fedora}
diff --git a/src/Makefile.am b/src/Makefile.am
index f964836..7d7e91b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ AM_CPPFLAGS = \
$(JSON_GLIB_CFLAGS) \
$(LIBSECRET_CFLAGS) \
$(PIE_CFLAGS) \
+ $(VALGRIND_CFLAGS) \
-DG_LOG_DOMAIN=\"Gs\" \
-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
-DLIBDIR=\"$(libdir)\" \
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index d858632..879d5da 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -47,6 +47,8 @@
#include <gio/gdesktopappinfo.h>
#include <gdk/gdk.h>
+#include <valgrind.h>
+
#include "gs-app-list-private.h"
#include "gs-os-release.h"
#include "gs-plugin-private.h"
@@ -208,8 +210,10 @@ gs_plugin_finalize (GObject *object)
g_mutex_clear (&priv->cache_mutex);
g_mutex_clear (&priv->timer_mutex);
g_mutex_clear (&priv->vfuncs_mutex);
+#ifndef RUNNING_ON_VALGRIND
if (priv->module != NULL)
g_module_close (priv->module);
+#endif
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]