diff options
| author | 2025-05-22 11:18:48 +0200 | |
|---|---|---|
| committer | 2025-05-22 11:18:48 +0200 | |
| commit | 56816b305155fee2154c7991ba9be8c0e7671307 (patch) | |
| tree | 48e09b5fd7ae62f75f7bb4e6de7d00f9e374047f | |
| parent | Merge pull request 'use utf-8 lowercase function for tags #396' (#400) from p... (diff) | |
| download | snac2-56816b305155fee2154c7991ba9be8c0e7671307.tar.gz snac2-56816b305155fee2154c7991ba9be8c0e7671307.tar.xz snac2-56816b305155fee2154c7991ba9be8c0e7671307.zip | |
Minor memory leak fixes.
| -rw-r--r-- | activitypub.c | 2 | ||||
| -rw-r--r-- | data.c | 8 | ||||
| -rw-r--r-- | format.c | 2 | ||||
| -rw-r--r-- | mastoapi.c | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/activitypub.c b/activitypub.c index c06d8df..0cc7bcb 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -903,7 +903,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag) | |||
| 903 | if (*v == '#') { | 903 | if (*v == '#') { |
| 904 | /* hashtag */ | 904 | /* hashtag */ |
| 905 | xs *d = xs_dict_new(); | 905 | xs *d = xs_dict_new(); |
| 906 | xs *n = xs_utf8_to_lower(xs_dup(v)); | 906 | xs *n = xs_utf8_to_lower(v); |
| 907 | xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1); | 907 | xs *h = xs_fmt("%s?t=%s", srv_baseurl, n + 1); |
| 908 | xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v); | 908 | xs *l = xs_fmt("<a href=\"%s\" class=\"mention hashtag\" rel=\"tag\">%s</a>", h, v); |
| 909 | 909 | ||
| @@ -2247,7 +2247,7 @@ xs_str *tag_fn(const char *tag) | |||
| 2247 | if (*tag == '#') | 2247 | if (*tag == '#') |
| 2248 | tag++; | 2248 | tag++; |
| 2249 | 2249 | ||
| 2250 | xs *lw_tag = xs_utf8_to_lower(xs_dup(tag)); | 2250 | xs *lw_tag = xs_utf8_to_lower(tag); |
| 2251 | xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag)); | 2251 | xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag)); |
| 2252 | 2252 | ||
| 2253 | return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5); | 2253 | 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) | |||
| 2832 | srv_debug(1, xs_fmt("content_match: loading regexes from %s", fn)); | 2832 | srv_debug(1, xs_fmt("content_match: loading regexes from %s", fn)); |
| 2833 | 2833 | ||
| 2834 | /* massage content (strip HTML tags, etc.) */ | 2834 | /* massage content (strip HTML tags, etc.) */ |
| 2835 | xs *c = xs_regex_replace(v, "<[^>]+>", " "); | 2835 | xs *c1 = xs_regex_replace(v, "<[^>]+>", " "); |
| 2836 | c = xs_regex_replace_i(c, " {2,}", " "); | 2836 | c1 = xs_regex_replace_i(c1, " {2,}", " "); |
| 2837 | c = xs_utf8_to_lower(c); | 2837 | xs *c = xs_utf8_to_lower(c1); |
| 2838 | 2838 | ||
| 2839 | while (!r && !feof(f)) { | 2839 | while (!r && !feof(f)) { |
| 2840 | xs *rx = xs_strip_i(xs_readline(f)); | 2840 | xs *rx = xs_strip_i(xs_readline(f)); |
| @@ -444,7 +444,7 @@ xs_str *sanitize(const char *content) | |||
| 444 | if (n & 0x1) { | 444 | if (n & 0x1) { |
| 445 | xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1)); | 445 | xs *s1 = xs_strip_i(xs_crop_i(xs_dup(v), v[1] == '/' ? 2 : 1, -1)); |
| 446 | xs *l1 = xs_split_n(s1, " ", 1); | 446 | xs *l1 = xs_split_n(s1, " ", 1); |
| 447 | xs *tag = xs_utf8_to_lower(xs_dup(xs_list_get(l1, 0))); | 447 | xs *tag = xs_utf8_to_lower(xs_list_get(l1, 0)); |
| 448 | xs *s2 = NULL; | 448 | xs *s2 = NULL; |
| 449 | int i; | 449 | int i; |
| 450 | 450 | ||
| @@ -1638,7 +1638,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1638 | const char *aq = xs_dict_get(args, "q"); | 1638 | const char *aq = xs_dict_get(args, "q"); |
| 1639 | 1639 | ||
| 1640 | if (!xs_is_null(aq)) { | 1640 | if (!xs_is_null(aq)) { |
| 1641 | xs *q = xs_utf8_to_lower(xs_dup(aq)); | 1641 | xs *q = xs_utf8_to_lower(aq); |
| 1642 | out = xs_list_new(); | 1642 | out = xs_list_new(); |
| 1643 | xs *wing = following_list(&snac1); | 1643 | xs *wing = following_list(&snac1); |
| 1644 | xs *wers = follower_list(&snac1); | 1644 | xs *wers = follower_list(&snac1); |