Fixed memory leaks in TranscodingDataStream and HttpServer.

This commit is contained in:
casey langen 2017-05-06 11:40:59 -07:00
parent 0aff544712
commit 3dca4ff746
2 changed files with 9 additions and 3 deletions

View File

@ -128,7 +128,8 @@ static ssize_t fileReadCallback(void *cls, uint64_t pos, char *buf, size_t max)
static void fileFreeCallback(void *cls) {
Range* range = static_cast<Range*>(cls);
if (range->file) {
range->file->Close();
range->file->Destroy();
range->file = nullptr;
}
delete range;
}
@ -322,7 +323,6 @@ int HttpServer::HandleRequest(
delete range;
if (file) {
file->Close();
file->Destroy();
file = nullptr;
}
@ -371,7 +371,8 @@ int HttpServer::HandleRequest(
}
}
else {
file->Close();
file->Destroy();
file = nullptr;
}
}
}

View File

@ -110,6 +110,11 @@ bool TranscodingDataStream::Close() {
this->input = nullptr;
}
if (this->lame) {
lame_close(this->lame);
this->lame = nullptr;
}
if (this->outFile) {
fclose(this->outFile);
this->outFile = nullptr;