summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2025-12-18 08:09:10 +0100
committerGravatar grunfink2025-12-18 08:09:10 +0100
commit7c065cbc9879582985cef3d3ad8b2ae197b8b851 (patch)
tree568ca6194ba6071c1f1a0ab20347e4852cb122b5
parentAdded emoji reactions (contributed by violette). (diff)
downloadsnac2-7c065cbc9879582985cef3d3ad8b2ae197b8b851.tar.gz
snac2-7c065cbc9879582985cef3d3ad8b2ae197b8b851.tar.xz
snac2-7c065cbc9879582985cef3d3ad8b2ae197b8b851.zip
Fixed some xs_dup() leaks.
-rw-r--r--activitypub.c2
-rw-r--r--data.c2
-rw-r--r--html.c4
3 files changed, 4 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c
index 19f0cc6..d19a428 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1643,7 +1643,7 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid)
1643 1643
1644 n_msg = xs_dict_set(n_msg, "content", content); 1644 n_msg = xs_dict_set(n_msg, "content", content);
1645 n_msg = xs_dict_set(n_msg, "accounts", accounts); 1645 n_msg = xs_dict_set(n_msg, "accounts", accounts);
1646 n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dup(xs_dict_get(n_msg, "to")), 1)); 1646 n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dict_get(n_msg, "to"), 1));
1647 n_msg = xs_dict_set(n_msg, "accountId", snac->uid); 1647 n_msg = xs_dict_set(n_msg, "accountId", snac->uid);
1648 n_msg = xs_dict_set(n_msg, "tag", tag); 1648 n_msg = xs_dict_set(n_msg, "tag", tag);
1649 1649
diff --git a/data.c b/data.c
index 07eea3c..bbe92b8 100644
--- a/data.c
+++ b/data.c
@@ -1599,7 +1599,7 @@ int timeline_admire(snac *snac, const char *id,
1599 /* use utf <3 as a like, as it is ugly */ 1599 /* use utf <3 as a like, as it is ugly */
1600 if (type && xs_match(type, "Like|EmojiReact|Emoji") && 1600 if (type && xs_match(type, "Like|EmojiReact|Emoji") &&
1601 content && strcmp(content, "❤") != 0) { 1601 content && strcmp(content, "❤") != 0) {
1602 ret = timeline_emoji_react(xs_dup(snac->actor), id, xs_dup(msg)); 1602 ret = timeline_emoji_react(snac->actor, id, xs_dup(msg));
1603 snac_debug(snac, 1, xs_fmt("timeline_emoji_react %s", id)); 1603 snac_debug(snac, 1, xs_fmt("timeline_emoji_react %s", id));
1604 } 1604 }
1605 1605
diff --git a/html.c b/html.c
index 8cc0067..dae84b7 100644
--- a/html.c
+++ b/html.c
@@ -5173,9 +5173,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
5173 } 5173 }
5174 else 5174 else
5175 if (strcmp(action, L("EmojiReact")) == 0) { /** **/ 5175 if (strcmp(action, L("EmojiReact")) == 0) { /** **/
5176 const char *eid = xs_dict_get(p_vars, "eid"); 5176 xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
5177 5177
5178 eid = xs_strip_chars_i(xs_dup(eid), ":"); 5178 eid = xs_strip_chars_i(eid, ":");
5179 5179
5180 const xs_dict *ret = msg_emoji_init(&snac, id, eid); 5180 const xs_dict *ret = msg_emoji_init(&snac, id, eid);
5181 /* fails if either invalid or already reacted */ 5181 /* fails if either invalid or already reacted */