commit 56816b305155fee2154c7991ba9be8c0e7671307
parent 096bb217105202ce6ec5bad046fd70cc3e3508cd
Author: grunfink <grunfink@comam.es>
Date: Thu, 22 May 2025 11:18:48 +0200
Minor memory leak fixes.
Diffstat:
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/activitypub.c b/activitypub.c
@@ -903,7 +903,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag)
if (*v == '#') {
/* hashtag */
xs *d = xs_dict_new();
- xs *n = xs_utf8_to_lower(xs_dup(v));
+ xs *n = xs_utf8_to_lower(v);
xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1);
xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v);
diff --git a/data.c b/data.c
@@ -2247,7 +2247,7 @@ xs_str *tag_fn(const char *tag)
if (*tag == '#')
tag++;
- xs *lw_tag = xs_utf8_to_lower(xs_dup(tag));
+ xs *lw_tag = xs_utf8_to_lower(tag);
xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag));
return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5);
@@ -2832,9 +2832,9 @@ int content_match(const char *file, const xs_dict *msg)
srv_debug(1, xs_fmt("content_match: loading regexes from %s", fn));
/* massage content (strip HTML tags, etc.) */
- xs *c = xs_regex_replace(v, "<[^>]+>", " ");
- c = xs_regex_replace_i(c, " {2,}", " ");
- c = xs_utf8_to_lower(c);
+ xs *c1 = xs_regex_replace(v, "<[^>]+>", " ");
+ c1 = xs_regex_replace_i(c1, " {2,}", " ");
+ xs *c = xs_utf8_to_lower(c1);
while (!r && !feof(f)) {
xs *rx = xs_strip_i(xs_readline(f));
diff --git a/format.c b/format.c
@@ -444,7 +444,7 @@ xs_str *sanitize(const char *content)
if (n & 0x1) {
xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1));
xs *l1 = xs_split_n(s1, " ", 1);
- xs *tag = xs_utf8_to_lower(xs_dup(xs_list_get(l1, 0)));
+ xs *tag = xs_utf8_to_lower(xs_list_get(l1, 0));
xs *s2 = NULL;
int i;
diff --git a/mastoapi.c b/mastoapi.c
@@ -1638,7 +1638,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
const char *aq = xs_dict_get(args, "q");
if (!xs_is_null(aq)) {
- xs *q = xs_utf8_to_lower(xs_dup(aq));
+ xs *q = xs_utf8_to_lower(aq);
out = xs_list_new();
xs *wing = following_list(&snac1);
xs *wers = follower_list(&snac1);