aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-12-18 08:41:28 +0100
committergrunfink <grunfink@comam.es>2025-12-18 08:41:28 +0100
commitfd45b94c09233221d7b98a7270c768272bd25ac9 (patch)
tree2d79d581a57529c83498a17c216dea032f5334c3
parentc8ee70f6df7276b7c02f902cc544d209139697b2 (diff)
Fixed leak in timeline_admire().
-rw-r--r--data.c7
-rw-r--r--snac.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/data.c b/data.c
index bbe92b8..8f7050c 100644
--- a/data.c
+++ b/data.c
@@ -1567,9 +1567,10 @@ int timeline_add(snac *snac, const char *id, const xs_dict *o_msg)
}
-int timeline_emoji_react(const char *act, const char *id, xs_dict *msg)
+int timeline_emoji_react(const char *act, const char *id, const xs_dict *msg_o)
/* adds an emoji reaction to a message */
{
+ xs *msg = xs_dup(msg_o);
msg = xs_dict_append(msg, "attributedTo", act);
msg = xs_dict_set(msg, "type", "EmojiReact");
const char *emote_id = xs_dict_get(msg, "id");
@@ -1583,7 +1584,7 @@ int timeline_emoji_react(const char *act, const char *id, xs_dict *msg)
int timeline_admire(snac *snac, const char *id,
- const char *admirer, int like, xs_dict *msg)
+ const char *admirer, int like, const xs_dict *msg)
/* updates a timeline entry with a new admiration or emoji reaction */
{
int ret;
@@ -1599,7 +1600,7 @@ int timeline_admire(snac *snac, const char *id,
/* use utf <3 as a like, as it is ugly */
if (type && xs_match(type, "Like|EmojiReact|Emoji") &&
content && strcmp(content, "❤") != 0) {
- ret = timeline_emoji_react(snac->actor, id, xs_dup(msg));
+ ret = timeline_emoji_react(snac->actor, id, msg);
snac_debug(snac, 1, xs_fmt("timeline_emoji_react %s", id));
}
diff --git a/snac.h b/snac.h
index 3d98aac..23f363c 100644
--- a/snac.h
+++ b/snac.h
@@ -183,8 +183,8 @@ xs_str *user_index_fn(snac *user, const char *idx_name);
xs_list *timeline_simple_list(snac *user, const char *idx_name, int skip, int show, int *more);
xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show, int *more);
int timeline_add(snac *snac, const char *id, const xs_dict *o_msg);
-int timeline_admire(snac *snac, const char *id, const char *admirer, int like, xs_dict *msg);
-int timeline_emoji_react(const char *atto, const char *id, xs_dict *o_msg);
+int timeline_admire(snac *snac, const char *id, const char *admirer, int like, const xs_dict *msg);
+int timeline_emoji_react(const char *atto, const char *id, const xs_dict *o_msg);
xs_list *timeline_top_level(snac *snac, const xs_list *list);
void timeline_add_mark(snac *user);