On Tue, Apr 06, 2010 at 08:54:59AM +0200, Max Kellermann wrote:
> On 2010/04/06 08:42, Tony Miller <mcfiredr...@gmail.com> wrote:
> > +    if((gme_err = gme_open_file(path_fs, &emu, sample_rate)) != NULL){
> > +        g_warning("%s\n", gme_err);
> > +        gme_delete(emu);
> 
> Is that correct?  Does gme_open_file() allocate the second parameter
> even if it returns with an error?
> 
Upon further inspection of the GME source, gme_open_file appears to take
care of deleting "emu" for you if it returns an error, so gme_delete will be
unnecessary.

I'll try to get it to actually throw an error just to make sure.

> > +        gme_delete(emu);
> > +        gme_free_info(ti);
> 
> Usually, it's a good idea to deallocate in reverse order, because a
> "ti" may hold a reference to "emu".  Don't know about GME.
> 

Wouldn't I do this order then, to be in reverse:
+        gme_free_info(ti);
+        gme_delete(emu);

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to