summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2023-04-12 12:16:23 +0200
committerGravatar default2023-04-12 12:16:23 +0200
commit8d9e4667b7ca7ba45414f952e430da57983af09a (patch)
treefa73bd39f0a0461157dc78cb72a3c430ff796264 /mastoapi.c
parentUpdated documentation. (diff)
downloadsnac2-8d9e4667b7ca7ba45414f952e430da57983af09a.tar.gz
snac2-8d9e4667b7ca7ba45414f952e430da57983af09a.tar.xz
snac2-8d9e4667b7ca7ba45414f952e430da57983af09a.zip
Added forgotten user cleanup in mastoapi_post_handler().
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 3cfaa34..94c29d1 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -867,7 +867,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
867 xs *msg = NULL; 867 xs *msg = NULL;
868 xs *out = NULL; 868 xs *out = NULL;
869 869
870 /* skip the fake part of the id (the date) */ 870 /* skip the 'fake' part of the id */
871 id = MID_TO_MD5(id); 871 id = MID_TO_MD5(id);
872 872
873 if (valid_status(timeline_get_by_md5(&snac, id, &msg))) { 873 if (valid_status(timeline_get_by_md5(&snac, id, &msg))) {
@@ -976,7 +976,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
976 xs *cmd = xs_replace(q_path, "/api/v1", ""); 976 xs *cmd = xs_replace(q_path, "/api/v1", "");
977 977
978 snac snac = {0}; 978 snac snac = {0};
979 int logged_in = process_auth_token(&snac, req);; 979 int logged_in = process_auth_token(&snac, req);
980 980
981 if (strcmp(cmd, "/apps") == 0) { 981 if (strcmp(cmd, "/apps") == 0) {
982 const char *name = xs_dict_get(args, "client_name"); 982 const char *name = xs_dict_get(args, "client_name");
@@ -1035,7 +1035,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1035 xs *msg = NULL; 1035 xs *msg = NULL;
1036 xs *out = NULL; 1036 xs *out = NULL;
1037 1037
1038 /* skip the fake part of the id (the date) */ 1038 /* skip the 'fake' part of the id */
1039 mid = MID_TO_MD5(mid); 1039 mid = MID_TO_MD5(mid);
1040 1040
1041 if (valid_status(timeline_get_by_md5(&snac, mid, &msg))) { 1041 if (valid_status(timeline_get_by_md5(&snac, mid, &msg))) {
@@ -1111,5 +1111,9 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1111 status = 401; 1111 status = 401;
1112 } 1112 }
1113 1113
1114 /* user cleanup */
1115 if (logged_in)
1116 user_free(&snac);
1117
1114 return status; 1118 return status;
1115} 1119}