Skip to content

Commit 5dd0db3

Browse files
committed
flac: fix leak; properly close stream upon closing FlacAudioCursor
1 parent da079c5 commit 5dd0db3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

panda/src/movies/flacAudioCursor.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ FlacAudioCursor::
5959
FlacAudioCursor(FlacAudio *src, std::istream *stream) :
6060
MovieAudioCursor(src),
6161
_is_valid(false),
62-
_drflac(nullptr)
62+
_drflac(nullptr),
63+
_stream(stream)
6364
{
6465
nassertv(stream != nullptr);
6566
nassertv(stream->good());
@@ -91,6 +92,9 @@ FlacAudioCursor::
9192
if (_drflac != nullptr) {
9293
drflac_close(_drflac);
9394
}
95+
if (_stream != nullptr) {
96+
VirtualFileSystem::close_read_file(_stream);
97+
}
9498
}
9599

96100
/**

panda/src/movies/flacAudioCursor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class EXPCL_PANDA_MOVIES FlacAudioCursor : public MovieAudioCursor {
4141

4242
protected:
4343
drflac *_drflac;
44+
std::istream *_stream;
4445

4546
public:
4647
static TypeHandle get_class_type() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy