From ce0cf6d3e439b12c9a2d097e130e2340be3491d0 Mon Sep 17 00:00:00 2001 From: nekobit Date: Tue, 1 Nov 2022 15:14:07 +0000 Subject: [PATCH] Cleanup data FossilOrigin-Name: 629c8537277cf9905ad942148944ce97d5eb21451b667ce0a15436f679efee22 --- include/mastodont.h | 2 +- src/mastodont.c | 7 +++++-- src/request.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/mastodont.h b/include/mastodont.h index 8d8f837..fe2b8e4 100644 --- a/include/mastodont.h +++ b/include/mastodont.h @@ -58,6 +58,6 @@ void mstdnt_cleanup(mastodont_t* data); */ void mstdnt_storage_cleanup(struct mstdnt_storage* storage); -void mstdnt_request_cb_cleanup(mstdnt_request_cb_t* data); +void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data); #endif /* MASTODONT_H */ diff --git a/src/mastodont.c b/src/mastodont.c index 0bd8100..0f61c50 100644 --- a/src/mastodont.c +++ b/src/mastodont.c @@ -34,7 +34,10 @@ void mstdnt_storage_cleanup(struct mstdnt_storage* storage) } } -void mstdnt_request_cb_cleanup(mstdnt_request_cb_t* data) +void mstdnt_request_cb_cleanup(mstdnt_request_cb_data* data) { - + mstdnt_storage_cleanup(data->storage); + free(data->storage); + data->data_free_cb(data->data); + free(data); } diff --git a/src/request.c b/src/request.c index 9ee0602..a56b900 100644 --- a/src/request.c +++ b/src/request.c @@ -165,5 +165,5 @@ cleanup: /* Only free if params_query set */ if (args->params_query) mstdnt_free(url_query); - return res; + return 1; }