[opus] libopusfile's memory management.

Timothy B. Terriberry tterribe at xiph.org
Sat Aug 24 19:56:42 PDT 2013

alpha thinktink wrote:
> is returning in tags handlers.  So of course when I call opus_tags_clear
> or any other tags modification routine on an OpusTags struct with
> contents created by my call to malloc it throws an exception.

Yes, this doesn't work in Windows (it works everywhere else). You can't 
use malloc/free across module boundaries unless both modules are linked 
to the same DLL version of libc (static linking to libc also doesn't work).

> At the moment I've worked around it by loading and using MSVCRT.dll's
> malloc, calloc, realloc, and free but I have a feeling it's the wrong
> way to go about that.  I found it in the call stack trace when my
> debugger caught an application defined exception on the call to
> opus_tags_clear.

Well, the first question I would ask is, why are you malloc'ing your own 
memory for an OpusTags structure? Is there some missing API that we 
could provide that would just avoid the problem?

More information about the opus mailing list