[Libav-user] (AVStream *)av_malloc(sizeof(AVStream)) crashed the application

Geek.Song ffmpeg at gmail.com
Tue Oct 30 12:28:53 CET 2012


On Tue, Oct 30, 2012 at 7:18 PM, Wenpeng Zhou <zhou.wenpeng at rdnet.fi> wrote:
> Hi Chandranath
>
>
>
> Thanks!
>
>
>
> But I already allocated memory for the pointer *ic_enc_mjpeg
>
>
>
> AVFormatContext *ic_enc_mjpeg;
>
> ic_enc_mjpeg = (AVFormatContext *)av_malloc(sizeof(AVFormatContext));
>
>
>
> Then I tried to allocate the memory for ic_enc_mjpeg->streams[0], then it
> crashed.
>

ic_enc_mjpeg->streams is uninitialized after av_malloc(sizeof(AVFormatContext));

it is a double pointer which could be assigned with 0xdeadbeef, you
can not use ic_enc_mjpeg[0] as left value directly.

-- 
-----------------------------------------------------------------------------------------
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2


More information about the Libav-user mailing list