summaryrefslogtreecommitdiffstats
path: root/src/libnftables.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-09-19 14:36:16 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-09-19 17:26:27 +0200
commit96ee78ec4a0707114d2f8ef7590d08cfd25080ea (patch)
tree710b3b3056d8127ebd788f78fca4a2d26df7a5d4 /src/libnftables.c
parent7b491e0c068c9881accfb571db3fb8f2f5799ca2 (diff)
libnftables: drop gmp_init() and mp_set_memory_functions()
Setting global handles for libgmp via mp_set_memory_functions() is very ugly. When we don't use mini-gmp, then potentially there are other users of the library in the same process, and every process fighting about the allocation functions is not gonna work. It also means, we must not reset the allocation functions after somebody already allocated GMP data with them. Which we cannot ensure, as we don't know what other parts of the process are doing. It's also unnecessary. The default allocation functions for gmp and mini-gmp already abort the process on allocation failure ([1], [2]), just like our xmalloc(). Just don't do this. [1] https://gmplib.org/repo/gmp/file/8225bdfc499f/memory.c#l37 [2] https://git.netfilter.org/nftables/tree/src/mini-gmp.c?id=6d19a902c1d77cb51b940b1ce65f31b1cad38b74#n286 Signed-off-by: Thomas Haller <thaller@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r--src/libnftables.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/libnftables.c b/src/libnftables.c
index 7d36577d..cedd710b 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -196,7 +196,6 @@ struct nft_ctx *nft_ctx_new(uint32_t flags)
if (!init_once) {
init_once = true;
- gmp_init();
#ifdef HAVE_LIBXTABLES
xt_init();
#endif