Klaus Schmidinger wrote:
Stefan Huelswitt wrote:
Hi, while investigating VDR with valgrind and other memory tracing tools, I found two places where memory leaks.
First is in dvbplayer.c, where the Action() code builds a frame from the replayed file (readFrame). If the ringbuffer is already full, this frame cannot be put immediately. If Empty() is called in such a situation, the premade frame is lost. Solution:
--- dvbplayer.c 2005-01-14 15:00:56.000000000 +0100 +++ dvbplayer.c 2005-03-26 21:41:23.000000000 +0100 @@ -296,6 +296,7 @@ nonBlockingFileReader->Clear(); if ((readIndex = backTrace->Get(playDir == pdForward)) < 0) readIndex = writeIndex;
- delete readFrame; readFrame = NULL; playFrame = NULL; ringBuffer->Clear();
Very well spotted!
I believe the same should be done in cDvbPlayer::~cDvbPlayer() (just tested it, it also happens there).
Like this?
cDvbPlayer::~cDvbPlayer() { Detach(); Save(); delete index; delete fileName; delete backTrace; delete readFrame; delete ringBuffer; }
Best Regards,