From bbbf5724bec2e235a18eb84728c6f13d33a0eb58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 16 Jun 2021 19:20:24 +0200 Subject: [PATCH] pipewire: module-zeroconf-discover: free correct pointer Retrieve the pointer returned by `calloc()` and free that instead of freeing the pointer to a member. This has worked so far because as of yet `api` is the first member of the struct. --- src/modules/module-zeroconf-discover/avahi-poll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/module-zeroconf-discover/avahi-poll.c b/src/modules/module-zeroconf-discover/avahi-poll.c index 033d16a9f..c6550137f 100644 --- a/src/modules/module-zeroconf-discover/avahi-poll.c +++ b/src/modules/module-zeroconf-discover/avahi-poll.c @@ -187,5 +187,7 @@ AvahiPoll* pw_avahi_poll_new(struct pw_loop *loop) void pw_avahi_poll_free(AvahiPoll *p) { - free(p); + struct impl *impl = SPA_CONTAINER_OF(p, struct impl, api); + + free(impl); }