#7858 closed defect (fixed)
Incorrect function used in the avio_reading.c example
Reported by: | Ferneu | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | documentation |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The avio_reading.c example uses av_freep()
to free the AVIOContext
it allocated with avio_alloc_context()
I believe it should be using avio_context_free()
instead.
And while we are at it, you guys should really consider completely removing the buffer avio_alloc_context()
requires/allow the user to pass. Since according to the docs the AVIOContext
is free to reallocate that buffer at will and, in my experience, it usually does that, the user always ends up with a dangling pointer in case he was hoping to perform some sane resource management (i.e., free the things he allocated).
The "correct" way to free the AVIOContext
(first call av_freep(&avio_ctx->buffer)
and then free the context itself) is not intuitive at all, and since you guys already have avio_context_free()
, you should make it take care of doing that.
Change History (3)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 5 years ago
Component: | avformat → documentation |
---|---|
Keywords: | AVIOContext avio_context_free buffer removed |
Refer to the commit a0877648472a25debc9bd7957684748a253c2b52, Thanks.
BTW: Update API as the suggestion is the other issue, I think.