|
| 1 | +From bfd12cf73d81919843383598e4a9e64c6e5fd97a Mon Sep 17 00:00:00 2001 |
| 2 | +From: Khem Raj <raj.khem@gmail.com> |
| 3 | +Date: Fri, 21 Nov 2025 00:29:10 -0800 |
| 4 | +Subject: [PATCH] glib_stubs: avoid GLib g_free macro redefinition error |
| 5 | + |
| 6 | +glib 2.78+ defines g_free as an object-size checking macro. |
| 7 | +open-vm-tools overrides g_free(), leading to preprocessor expansion |
| 8 | +inside the function signature and breaking the build. |
| 9 | + |
| 10 | +Undefine the macro before defining the stub. |
| 11 | + |
| 12 | +Upstream-Status: Pending |
| 13 | +Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | +--- |
| 15 | + lib/rpcChannel/glib_stubs.c | 3 +++ |
| 16 | + 1 file changed, 3 insertions(+) |
| 17 | + |
| 18 | +diff --git a/lib/rpcChannel/glib_stubs.c b/lib/rpcChannel/glib_stubs.c |
| 19 | +index c32deb073..cb89c6a87 100644 |
| 20 | +--- a/lib/rpcChannel/glib_stubs.c |
| 21 | ++++ b/lib/rpcChannel/glib_stubs.c |
| 22 | +@@ -35,6 +35,9 @@ |
| 23 | + |
| 24 | + void *g_malloc0(size_t s) { return Util_SafeCalloc(1, s); } |
| 25 | + void *g_malloc0_n(size_t n, size_t s) { return Util_SafeCalloc(n, s); } |
| 26 | ++/* GLib defines g_free as a macro, so undefine it before providing |
| 27 | ++ * our own stub implementation. */ |
| 28 | ++#undef g_free |
| 29 | + void g_free(void *p) { free(p); } |
| 30 | + |
| 31 | + void g_mutex_init(GMutex *mutex) { } |
0 commit comments