[ANNOUNCE] VDR developer version 1.3.49 - Memleak

Message ID 44535DEF.5010106@e-tobi.net
State New
Headers

Commit Message

Tobias Grimm April 29, 2006, 12:37 p.m. UTC
  Klaus Schmidinger wrote:

> Thanks - applied for version 1.4.0.


I'm afraid I've found another minor memory leak. Valgrind would really
be worth it's money, if it wouldn't be free :-)

When playing back a recording, the file handle gets closed, but not the
cUnbufferedFile object. I'm not sure why a distinction is made between
recording and not recording when closing the file, so I just use
CloseVideoFile() in both cases, which correctly frees the object. Hope
this is correct. See attached patch.

Regards,

Tobias
  

Comments

Klaus Schmidinger April 29, 2006, 1:24 p.m. UTC | #1
Tobias Grimm wrote:
> Klaus Schmidinger wrote:
> 
>> Thanks - applied for version 1.4.0.
> 
> 
> I'm afraid I've found another minor memory leak. Valgrind would really
> be worth it's money, if it wouldn't be free :-)
> 
> When playing back a recording, the file handle gets closed, but not the
> cUnbufferedFile object. I'm not sure why a distinction is made between
> recording and not recording when closing the file, so I just use
> CloseVideoFile() in both cases, which correctly frees the object. Hope
> this is correct. See attached patch.
> 
> Regards,
> 
> Tobias
> 
> 
> ------------------------------------------------------------------------
> 
> --- vdr-1.3.49.orig/recording.c
> +++ vdr-1.3.49/recording.c
> @@ -1436,7 +1436,7 @@
>  void cFileName::Close(void)
>  {
>    if (file) {
> -     if ((record && CloseVideoFile(file) < 0) || (!record && file->Close() < 0))
> +     if (CloseVideoFile(file))
>          LOG_ERROR_STR(fileName);
>       file = NULL;
>       }

The CloseVideoFile() function is the counterpart to the OpenVideoFile()
function, which takes care of handling distributed video directories etc.
Before the introduction of cUnbufferedFile the code in cFileName::Close()
was ok, but now it would appear that your change is actually the right
thing to do.

Applied for version 1.4.0.

Klaus
  

Patch

--- vdr-1.3.49.orig/recording.c
+++ vdr-1.3.49/recording.c
@@ -1436,7 +1436,7 @@ 
 void cFileName::Close(void)
 {
   if (file) {
-     if ((record && CloseVideoFile(file) < 0) || (!record && file->Close() < 0))
+     if (CloseVideoFile(file))
         LOG_ERROR_STR(fileName);
      file = NULL;
      }