commit 8d9e466

default  ·  2023-04-12 10:16:23 +0000 UTC
parent 7fecec1
Added forgotten user cleanup in mastoapi_post_handler().
1 files changed,  +7, -3
+7, -3
 1@@ -867,7 +867,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2             xs *msg = NULL;
 3             xs *out = NULL;
 4 
 5-            /* skip the fake part of the id (the date) */
 6+            /* skip the 'fake' part of the id */
 7             id = MID_TO_MD5(id);
 8 
 9             if (valid_status(timeline_get_by_md5(&snac, id, &msg))) {
10@@ -976,7 +976,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
11     xs *cmd = xs_replace(q_path, "/api/v1", "");
12 
13     snac snac = {0};
14-    int logged_in = process_auth_token(&snac, req);;
15+    int logged_in = process_auth_token(&snac, req);
16 
17     if (strcmp(cmd, "/apps") == 0) {
18         const char *name  = xs_dict_get(args, "client_name");
19@@ -1035,7 +1035,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
20                 xs *msg = NULL;
21                 xs *out = NULL;
22 
23-                /* skip the fake part of the id (the date) */
24+                /* skip the 'fake' part of the id */
25                 mid = MID_TO_MD5(mid);
26 
27                 if (valid_status(timeline_get_by_md5(&snac, mid, &msg))) {
28@@ -1111,5 +1111,9 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
29             status = 401;
30     }
31 
32+    /* user cleanup */
33+    if (logged_in)
34+        user_free(&snac);
35+
36     return status;
37 }