From 8bad32ba99c40a1be0575e6009b1d3e6b4b1e7d6 Mon Sep 17 00:00:00 2001 From: nekobit Date: Sat, 21 May 2022 19:54:22 +0000 Subject: [PATCH] Fix emoji name memleak FossilOrigin-Name: fffec30d6351076827cd5685a9e8dd7dff79b1bdb46e6f02d966ff5a4ec5a2bd --- src/main.c | 2 +- src/status.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index d1499b0..22b481e 100644 --- a/src/main.c +++ b/src/main.c @@ -149,6 +149,6 @@ int main(void) } free_instance_info_cache(); - mastodont_free(&api); + mastodont_cleanup(&api); mastodont_global_curl_cleanup(); } diff --git a/src/status.c b/src/status.c index 1dce19c..e38fee6 100644 --- a/src/status.c +++ b/src/status.c @@ -347,7 +347,8 @@ char* get_in_reply_to(mastodont_t* api, struct mstdnt_status* status, size_t* si &storage); char* html = construct_in_reply_to(status, res == 0 ? &acct : NULL, size); - + + if (res == 0) mstdnt_cleanup_account(&acct); mastodont_storage_cleanup(&storage); return html; } @@ -589,6 +590,7 @@ char* construct_status(struct session* ssn, if (size) *size = s; // Cleanup + if (formatted_display_name != status->account.display_name) free(formatted_display_name); if (interaction_btns) free(interaction_btns); if (in_reply_to_str) free(in_reply_to_str); if (attachments) free(attachments);