From ed33b4d8772410eadf892ff25469102daa0340f7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 4 May 2026 13:20:00 +0200 Subject: [PATCH] jack: dlclose on errors --- src/modules/module-jack-tunnel/weakjack.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/module-jack-tunnel/weakjack.h b/src/modules/module-jack-tunnel/weakjack.h index 6a3d9bc67..287295d45 100644 --- a/src/modules/module-jack-tunnel/weakjack.h +++ b/src/modules/module-jack-tunnel/weakjack.h @@ -107,7 +107,7 @@ static inline int weakjack_load_by_path(struct weakjack *jack, const char *path) #define LOAD_SYM(name) ({ \ if ((jack->name = dlsym(hnd, "jack_"#name )) == NULL) \ - return -ENOSYS; \ + goto error; \ }) spa_zero(*jack); LOAD_SYM(cycle_wait); @@ -153,6 +153,9 @@ static inline int weakjack_load_by_path(struct weakjack *jack, const char *path) #undef LOAD_SYM return 0; +error: + dlclose(hnd); + return -ENOSYS; } static inline int weakjack_load(struct weakjack *jack, const char *lib)