Skip to content

Commit

Permalink
Fix memory leak when send headers in PsychicResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
dzungpv committed May 25, 2024
1 parent cebdbae commit ec80969
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/PsychicResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ void PsychicResponse::sendHeaders()
//now do our individual headers
for (HTTPHeader header : _headers)
httpd_resp_set_hdr(this->_request->request(), header.field, header.value);

// clean up our header variables after send
for (HTTPHeader header : _headers)
{
free(header.field);
free(header.value);
}
_headers.clear();
}

esp_err_t PsychicResponse::sendChunk(uint8_t *chunk, size_t chunksize)
Expand Down

0 comments on commit ec80969

Please sign in to comment.