From 461e3db7418b6546ebc4f80265ff67adf784c43c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 21 Dec 2020 20:07:02 +0100 Subject: [PATCH] tests: fix some leaks See #497 --- spa/plugins/audioconvert/test-helper.h | 7 ++++++- src/modules/module-protocol-native/test-connection.c | 5 +++++ src/tests/test-endpoint.c | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/test-helper.h b/spa/plugins/audioconvert/test-helper.h index 6748a7395..8c789bd45 100644 --- a/spa/plugins/audioconvert/test-helper.h +++ b/spa/plugins/audioconvert/test-helper.h @@ -78,6 +78,7 @@ error: static inline uint32_t get_cpu_flags(void) { struct spa_handle *handle; + uint32_t flags; void *iface; int res; @@ -88,5 +89,9 @@ static inline uint32_t get_cpu_flags(void) fprintf(stderr, "can't get CPU interface %s\n", spa_strerror(res)); return 0; } - return spa_cpu_get_flags((struct spa_cpu*)iface); + flags = spa_cpu_get_flags((struct spa_cpu*)iface); + + free(handle); + + return flags; } diff --git a/src/modules/module-protocol-native/test-connection.c b/src/modules/module-protocol-native/test-connection.c index 050216429..c30cf5c9b 100644 --- a/src/modules/module-protocol-native/test-connection.c +++ b/src/modules/module-protocol-native/test-connection.c @@ -145,5 +145,10 @@ int main(int argc, char *argv[]) test_create(out); test_read_write(in, out); + pw_protocol_native_connection_destroy(in); + pw_protocol_native_connection_destroy(out); + pw_context_destroy(context); + pw_main_loop_destroy(loop); + return 0; } diff --git a/src/tests/test-endpoint.c b/src/tests/test-endpoint.c index 94994c54c..d23758a16 100644 --- a/src/tests/test-endpoint.c +++ b/src/tests/test-endpoint.c @@ -444,6 +444,7 @@ static void test_endpoint(void) spa_assert(!d.bound_proxy); endpoint_clear(&d.endpoint); + pw_proxy_destroy((struct pw_proxy*)d.registry); pw_context_destroy(d.context); pw_main_loop_destroy(d.loop); }