Fix invalid argument and free correctly

FossilOrigin-Name: a695bf01ee6ac9214c0c024c7c4bdc8360ceb9e8034cefa619923eda7a30f997
This commit is contained in:
nekobit 2022-05-13 04:10:25 +00:00
parent fd07472dbc
commit 30c5bae8b3
2 changed files with 8 additions and 2 deletions

View file

@ -75,7 +75,6 @@ int mstdnt_notifications_json_callback(cJSON* json, void* _args)
return mstdnt_notifications_json(args->notif, args->size, json);
}
int mastodont_get_notifications(mastodont_t* data,
struct mstdnt_get_notifications_args* args,
struct mstdnt_storage* storage,

View file

@ -49,6 +49,10 @@ int mstdnt_status_json(struct mstdnt_status* status, cJSON* js)
{
cJSON* v;
// Not an error
if (!(status && js))
return 0;
/* Zero out */
memset(status, 0, sizeof(struct mstdnt_status));
@ -474,7 +478,7 @@ int mastodont_status_emoji_react(mastodont_t* api, char* id, char* emoji,
NULL, 0,
NULL, 0,
CURLOPT_PUT,
&status,
status,
mstdnt_status_json_callback
};
@ -487,7 +491,10 @@ void mstdnt_cleanup_status(struct mstdnt_status* status)
cleanup_status_pleroma(&(status->pleroma));
cleanup_emojis(status->emojis);
if (status->reblog)
{
mstdnt_cleanup_status(status->reblog);
free(status->reblog);
}
}
void mstdnt_cleanup_statuses(struct mstdnt_status* statuses, size_t s)