[ lame-Bugs-1948101 ] Memory not freed (lame-3.97, lame-3.98b8)

1 message Options
Embed this post
Permalink
SourceForge.net

[ lame-Bugs-1948101 ] Memory not freed (lame-3.97, lame-3.98b8)

Reply Threaded More More options
Print post
Permalink
Bugs item #1948101, was opened at 2008-04-21 17:09
Message generated for change (Comment added) made by robert
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=1948101&group_id=290

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Libraries
>Group: Quality
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Memory not freed (lame-3.97, lame-3.98b8)

Initial Comment:
File:
libmp3lame/lame.c

Functions:
lame_global_flags * lame_init(void)
int lame_init_old(lame_global_flags * gfp)
int lame_close(lame_global_flags * gfp)

a call to lame_init() allocates two chunks of memory worth 616+142032 bytes on my system:
first:
    gfp = calloc(1, sizeof(lame_global_flags));
then:
    gfc = gfp->internal_flags = calloc(1, sizeof(lame_internal_flags)))
in lame_init_old


If the developer never calls lame_init_params() on this object,
then the following test in lame_close() will be satisfied:
    if (NULL == gfc || gfc->Class_ID != LAME_ID)
and therefore those two bits of memory will never be freed.

My suggestion is to split this test:
. if gfc == NULL then nothing and return (as it is now)
. if gfc->Class_ID != LAME ID then just free gfp->internal_flags and gfp and return

(I noticed this with Valgrind.)

----------------------------------------------------------------------

>Comment By: Robert Hegemann (robert)
Date: 2008-04-23 01:55

Message:
Logged In: YES
user_id=1106
Originator: NO

Thanks for finding this. A fix is now in CVS.

Robert


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=1948101&group_id=290

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev