commit 8df47c3
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
1 files changed,
+2,
-1
+2,
-1
1@@ -355,6 +355,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
2 else
3 if (strcmp(cmd, "/token") == 0) { /** **/
4 xs *wrk = NULL;
5+ xs *codewrk = NULL;
6 const char *gtype = xs_dict_get(args, "grant_type");
7 const char *code = xs_dict_get(args, "code");
8 const char *cid = xs_dict_get(args, "client_id");
9@@ -387,7 +388,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
10 I'm not sure of the impacts of this right now, but Subway Tooter does not
11 provide a code so one must be generated */
12 if (xs_is_null(code)){
13- code = random_str();
14+ code = codewrk = random_str();
15 }
16 if (gtype && code && cid && csec && ruri) {
17 xs *app = app_get(cid);