From 297a2a4f8a285e08d0ad77104a7282af85216ef6 Mon Sep 17 00:00:00 2001 From: nekobit Date: Sat, 14 May 2022 21:41:15 +0000 Subject: [PATCH] Check if formatted status for notification isn't constant string FossilOrigin-Name: 3a4f7af4afdfb696214e04decb859076cc67fa697fa5a1714c76bbedd948b7b6 --- src/base_page.c | 2 +- src/notifications.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/base_page.c b/src/base_page.c index 4013b30..3f27dc2 100644 --- a/src/base_page.c +++ b/src/base_page.c @@ -42,7 +42,7 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t* // Mastodont, used for notifications sidebar struct mstdnt_storage storage = { 0 }; struct mstdnt_notification* notifs = NULL; - size_t notifs_len; + size_t notifs_len = 0; read_config(ssn); diff --git a/src/notifications.c b/src/notifications.c index 0147ba6..6d349f2 100644 --- a/src/notifications.c +++ b/src/notifications.c @@ -90,7 +90,7 @@ char* construct_notification_compact(struct session* ssn, int* size) { char* notif_html; - char* status_format; + char* status_format = NULL; char* notif_stats = NULL; const char* type_str = notification_type_compact_str(notif->type); @@ -106,9 +106,6 @@ char* construct_notification_compact(struct session* ssn, notif->status->emojis, notif->status->emojis_len); } - else { - status_format = NULL; - } size_t s = easprintf(¬if_html, data_notification_compact_html, notif->account->avatar, @@ -127,7 +124,8 @@ char* construct_notification_compact(struct session* ssn, if (size) *size = s; - if (status_format) free(status_format); + if (status_format && + status_format != notif->status->content) free(status_format); if (notif_stats) free(notif_stats); return notif_html; }