aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@noreply.codeberg.org>2026-05-22 17:19:26 +0200
committergrunfink <grunfink@noreply.codeberg.org>2026-05-22 17:19:26 +0200
commit8df47c39b9666269b276c94d17e7e418a26ce2f1 (patch)
tree34e07410a7448d2a489e4c085dcff54e662d5e4e
parentfbbc4e808631b81f0baf43ffc6ea12be603e4d79 (diff)
parent6dd81fc9677a521fd7689126c5340ffe366b7a96 (diff)
Merge pull request 'Memory leak fix' (#615) from inz/snac2:fix/mastoapi-token-leak into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/615
-rw-r--r--mastoapi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 1ddcdc4..1f4928e 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -355,6 +355,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
else
if (strcmp(cmd, "/token") == 0) { /** **/
xs *wrk = NULL;
+ xs *codewrk = NULL;
const char *gtype = xs_dict_get(args, "grant_type");
const char *code = xs_dict_get(args, "code");
const char *cid = xs_dict_get(args, "client_id");
@@ -387,7 +388,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
I'm not sure of the impacts of this right now, but Subway Tooter does not
provide a code so one must be generated */
if (xs_is_null(code)){
- code = random_str();
+ code = codewrk = random_str();
}
if (gtype && code && cid && csec && ruri) {
xs *app = app_get(cid);