FFMPEG Copyright(): Fix memory leak

Fix a memory leak I introduced.  Followed Stippi's suggestion. Thanks!
This commit is contained in:
Philippe Saint-Pierre
2012-06-25 11:05:01 -04:00
parent c589e68f42
commit 9741d697e8
2 changed files with 8 additions and 8 deletions
@@ -18,7 +18,6 @@
#include <MediaDefs.h>
#include <MediaFormats.h>
#include <InterfaceDefs.h>
#include <String.h>
extern "C" {
#include "avcodec.h"
@@ -1453,6 +1452,7 @@ AVFormatReader::Stream::Seek(uint32 flags, int64* frame, bigtime_t* time)
AVFormatReader::AVFormatReader()
:
fCopyright(""),
fStreams(NULL),
fSourceLock("source I/O lock")
{
@@ -1481,14 +1481,12 @@ AVFormatReader::~AVFormatReader()
const char*
AVFormatReader::Copyright()
{
BMessage* message = new BMessage();
if (GetMetaData(message) == B_OK) {
const char* copyright;
if (message->FindString("copyright", &copyright) == B_OK)
return copyright;
if (fCopyright.Length() <= 0) {
BMessage message;
if (GetMetaData(&message) == B_OK)
message.FindString("copyright", &fCopyright);
}
delete message;
return "";
return fCopyright.String();
}
@@ -7,6 +7,7 @@
#include <Locker.h>
#include <String.h>
#include "ReaderPlugin.h"
@@ -48,6 +49,7 @@ public:
private:
class Stream;
BString fCopyright;
Stream** fStreams;
BLocker fSourceLock;
};