Fix use after free

FossilOrigin-Name: 7d1dd9f2fcbd48f57578275443c870d89e0feeec83289311635e3e0d8185556d
This commit is contained in:
nekobit 2022-06-20 21:18:01 +00:00
parent 5b4db3fb74
commit d4deadf064
2 changed files with 4 additions and 2 deletions

View file

@ -67,6 +67,7 @@ char* construct_notification(struct session* ssn,
char* construct_notification_action(struct mstdnt_notification* notif, size_t* size)
{
char* res;
char* display_name = emojify(notif->account->display_name,
notif->account->emojis,
notif->account->emojis_len);
@ -78,9 +79,10 @@ char* construct_notification_action(struct mstdnt_notification* notif, size_t* s
.action = notification_type_compact_str(notif->type),
.notif_svg = notification_type_svg(notif->type)
};
res = tmpl_gen_notification_action(&tdata, size);
if (display_name != notif->account->display_name)
free(display_name);
return tmpl_gen_notification_action(&tdata, size);
return res;
}
char* construct_notification_compact(struct session* ssn,

View file

@ -431,7 +431,7 @@ char* reformat_status(struct session* ssn,
if (emos)
{
emo_res = emojify(res, emos, emos_len);
if (emo_res != content && res != content)
if (emo_res != res && res != content)
free(res);
res = emo_res;
}