summaryrefslogtreecommitdiffstats
path: root/debian/patches/8680c74d1bd83b4969c9305171076b36f56d82fa.patch
blob: f7039c7baa13b7782cdde44ba4bfc072ceef8b9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 8680c74d1bd83b4969c9305171076b36f56d82fa Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 4 Oct 2023 10:59:26 +0200
Subject: [PATCH] check if malloc_trim() is available

---
 meson.build              | 1 +
 src/pipewire/impl-node.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

--- a/meson.build
+++ b/meson.build
@@ -401,6 +401,7 @@
   ['reallocarray', '#include <stdlib.h>', ['-D_GNU_SOURCE'], []],
   ['sigabbrev_np', '#include <string.h>', ['-D_GNU_SOURCE'], []],
   ['XSetIOErrorExitHandler', '#include <X11/Xlib.h>', [], [x11_dep]],
+  ['malloc_trim', '#include <malloc.h>', [], []],
 ]
 
 foreach f : check_functions
--- a/src/pipewire/impl-node.c
+++ b/src/pipewire/impl-node.c
@@ -1874,7 +1874,6 @@
 	struct pw_impl_node *follower;
 	struct pw_context *context = node->context;
 	bool active, had_driver;
-	int res;
 
 	active = node->active;
 	node->active = false;
@@ -1948,8 +1947,10 @@
 	spa_system_close(context->data_system, node->source.fd);
 	free(impl);
 
-	res = malloc_trim(0);
+#ifdef HAVE_MALLOC_TRIM
+	int res = malloc_trim(0);
 	pw_log_debug("malloc_trim(): %d", res);
+#endif
 }
 
 SPA_EXPORT