[ogg-dev] Fixing ogg vorbis corruption caused by bad metadata
Martin Leese
martin.leese at stanfordalumni.org
Wed Jul 22 18:24:20 PDT 2009
Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:
> Martin Leese wrote:
>> Anyway, calling alloc()s with no corresponding
>> free()s is a memory leak. Not good code.
>
> The alloca() function allocates space on the stack and
> that allocation is automatically freed when the function
> that did the allocation returns.
>
> The Linux man page is quite informative.
Yes, but is your code intended to work only
under Linux, and nowhere else? What
matters is what the C manual says, and C still
has no automatic garbage collection. It looks
like Microsoft currently supports C90 (with only
some of C99).
My ANSI C manual is old (1988), so things will
have changed, but in my copy alloc() is paired
with afree() and, further, calls to afree() must
be made in the opposite order to the calls
made on alloc(). (In my manual, malloc() is
paired with free(), and the order of the free()s
is unrestricted.)
Hopefully, things are not so restricted
nowadays.
Regards,
Martin
--
Martin J Leese
E-mail: martin.leese stanfordalumni.org
Web: http://members.tripod.com/martin_leese/
More information about the ogg-dev
mailing list