mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-29 21:32:41 +00:00
Fixed memory leaks in TranscodingDataStream and HttpServer.
This commit is contained in:
parent
0aff544712
commit
3dca4ff746
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user