From: Michael Tremer Date: Wed, 25 Jun 2025 11:16:48 +0000 (+0000) Subject: client: Remove any left-over uploads when freeing the client X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=982d8cec540cccba8b2a2812d8851f1b6e68e5f9;p=pakfire.git client: Remove any left-over uploads when freeing the client Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/client.c b/src/pakfire/client.c index e4d2c0e9..d430102f 100644 --- a/src/pakfire/client.c +++ b/src/pakfire/client.c @@ -241,12 +241,24 @@ static int pakfire_client_init(sd_event_source* event, void* data) { return 0; } +static void pakfire_client_upload_free(struct pakfire_client_upload* upload); + static void pakfire_client_free(struct pakfire_client* self) { + struct pakfire_client_upload* upload = NULL; + if (self->auth.access_timer) sd_event_source_unref(self->auth.access_timer); if (self->auth.refresh_timer) sd_event_source_unref(self->auth.refresh_timer); + // Free uploads + while (!STAILQ_EMPTY(&self->uploads)) { + upload = STAILQ_FIRST(&self->uploads); + + // Free the upload + pakfire_client_upload_free(upload); + } + // Event Loop if (self->loop) sd_event_unref(self->loop);