commit 7c065cb
grunfink
·
2025-12-18 07:09:10 +0000 UTC
parent 85ed0eb
Fixed some xs_dup() leaks.
3 files changed,
+4,
-4
+1,
-1
1@@ -1643,7 +1643,7 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid)
2
3 n_msg = xs_dict_set(n_msg, "content", content);
4 n_msg = xs_dict_set(n_msg, "accounts", accounts);
5- n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dup(xs_dict_get(n_msg, "to")), 1));
6+ n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dict_get(n_msg, "to"), 1));
7 n_msg = xs_dict_set(n_msg, "accountId", snac->uid);
8 n_msg = xs_dict_set(n_msg, "tag", tag);
9
M
data.c
+1,
-1
1@@ -1599,7 +1599,7 @@ int timeline_admire(snac *snac, const char *id,
2 /* use utf <3 as a like, as it is ugly */
3 if (type && xs_match(type, "Like|EmojiReact|Emoji") &&
4 content && strcmp(content, "❤") != 0) {
5- ret = timeline_emoji_react(xs_dup(snac->actor), id, xs_dup(msg));
6+ ret = timeline_emoji_react(snac->actor, id, xs_dup(msg));
7 snac_debug(snac, 1, xs_fmt("timeline_emoji_react %s", id));
8 }
9
M
html.c
+2,
-2
1@@ -5173,9 +5173,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
2 }
3 else
4 if (strcmp(action, L("EmojiReact")) == 0) { /** **/
5- const char *eid = xs_dict_get(p_vars, "eid");
6+ xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
7
8- eid = xs_strip_chars_i(xs_dup(eid), ":");
9+ eid = xs_strip_chars_i(eid, ":");
10
11 const xs_dict *ret = msg_emoji_init(&snac, id, eid);
12 /* fails if either invalid or already reacted */