[mythtv] [PATCH] mythvideo: videomanager.cpp & metadata.cpp

Colin Guthrie myth at colin.guthr.ie
Fri Dec 17 16:35:55 UTC 2004


Gareth Jones wrote:
> ===================================================================
> RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videomanager.cpp,v
> retrieving revision 1.38
> diff -u -r1.38 videomanager.cpp
> --- mythvideo/videomanager.cpp	19 Sep 2004 13:45:51 -0000	1.38
> +++ mythvideo/videomanager.cpp	17 Dec 2004 09:43:15 -0000
> @@ -648,6 +648,12 @@
>              ltype->ResetList();
>              ltype->SetActive(true);
>  
> +            if (curitem)
> +            {
> +                delete curitem;
> +                curitem = NULL;
> +            }
> +
>              for (it = start; it != end; ++it)
>              {
>                 if (cnt < listsize)
> @@ -666,8 +672,6 @@
>  
>                        if (cnt == inList)
>                        {
> -                          if (curitem)
> -                              delete curitem;
>                            curitem = new Metadata(*(it));
>                            ltype->SetItemCurrent(cnt);
>                        }


I've not had a look at the code so apologies for wasting your time if 
this is incorrect, but judging by the line numbers in the diff the 
second part looks as if it's in the above part's for loop...

If this is the case, does your change not introduce a memory leak in 
that issues curitem = new Metadata(*(it)); on each iteration without 
ever deleting the one allocated on the previous iteration?

Col.


-- 

+------------------------+
|     Colin Guthrie      |
+------------------------+
|  myth at colin.guthr.ie   |
| http://colin.guthr.ie/ |
+------------------------+


More information about the mythtv-dev mailing list