[vlc-devel] stream_Peek memory management...
fenrir at elivagar.org
Mon Sep 19 10:30:20 CEST 2011
On Sun, Sep 18, 2011 at 04:35:08PM -0700, Peter Tap wrote:
> In vlc code, I noticed that the memory allocated from stream_Peek is not
> released in the code. A typical usage pattern is:
> const uint8_t* p_Peek;
> stream_Peek(s, &p_Peek, num);
> So, when stream_Peek succeeds, it creates memory for p_Peek and fills it with
> required data.
Not always. It can return a pointer into cached data when possible, and if not
then allocate a buffer and copy the data in it.
> What is confusing is that no one ever releases this memory.
stream_t keeps the ownership of the memory and will release it itself when
it is disposed of, or until the next stream_Peek() call.
More information about the vlc-devel