Skip to content

Commit

Permalink
fix(rest_request): memory leak when using reason field
Browse files Browse the repository at this point in the history
This commit fixes a memory leak that happened when a reason was set for some request.
  • Loading branch information
ThePedroo authored and lcsmuller committed Apr 9, 2024
1 parent 59edc64 commit 88461c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/discord-rest_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ discord_request_cancel(struct discord_requestor *rqtor,

if (NOT_EMPTY_STR(req->reason)) {
ua_conn_remove_header(req->conn, "X-Audit-Log-Reason");
*req->reason = '\0';
free(req->reason);
req->reason = NULL;
}
if (req->conn) {
ua_conn_stop(req->conn);
Expand Down

0 comments on commit 88461c1

Please sign in to comment.