浏览代码

Fixed some xs_dup() leaks.

grunfink 7 月之前
父节点
当前提交
7c065cbc98
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      activitypub.c
  2. 1 1
      data.c
  3. 2 2
      html.c

+ 1 - 1
activitypub.c

@@ -1643,7 +1643,7 @@ xs_dict *msg_emoji_init(snac *snac, const char *mid, const char *eid)
 
     n_msg = xs_dict_set(n_msg, "content", content);
     n_msg = xs_dict_set(n_msg, "accounts", accounts);
-    n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dup(xs_dict_get(n_msg, "to")), 1));
+    n_msg = xs_dict_set(n_msg, "attributedTo", xs_list_get(xs_dict_get(n_msg, "to"), 1));
     n_msg = xs_dict_set(n_msg, "accountId", snac->uid);
     n_msg = xs_dict_set(n_msg, "tag", tag);
 

+ 1 - 1
data.c

@@ -1599,7 +1599,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(xs_dup(snac->actor), id, xs_dup(msg));
+        ret = timeline_emoji_react(snac->actor, id, xs_dup(msg));
         snac_debug(snac, 1, xs_fmt("timeline_emoji_react %s", id));
     }
 

+ 2 - 2
html.c

@@ -5173,9 +5173,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
         }
         else
         if (strcmp(action, L("EmojiReact")) == 0) { /** **/
-            const char *eid = xs_dict_get(p_vars, "eid");
+            xs *eid = xs_dup(xs_dict_get(p_vars, "eid"));
 
-            eid = xs_strip_chars_i(xs_dup(eid), ":");
+            eid = xs_strip_chars_i(eid, ":");
 
             const xs_dict *ret = msg_emoji_init(&snac, id, eid);
             /* fails if either invalid or already reacted */