[FFmpeg-devel] [PATCH 1/4] avformat/hashenc: use an array of hashes

Paul B Mahol onemda at gmail.com
Mon Aug 12 16:11:20 EEST 2019


On Mon, Aug 12, 2019 at 2:56 PM Moritz Barsnick <barsnick at gmx.net> wrote:

> On Sun, Aug 11, 2019 at 15:57:46 +0200, Nicolas George wrote:
> > > +    c->hashes = av_malloc_array(1, sizeof(c->hashes));
> > > +    if (!c->hashes)
> > > +        return AVERROR(ENOMEM);
> > > +    res = av_hash_alloc(&c->hashes[0], c->hash_name);
> > > +    if (res < 0) {
> > > +        av_freep(&c->hashes);
> >
> > Maybe move all the freing code in a deinit() function?
>
> Sure, I'll have a look how the other muxers do it.
>
> The code is later allocating hashes av_hash_alloc() in a loop over
> nb_streams. If this fails (i.e. out of memory) along the way, do I need
> to remember how many succeeded before? (See patch 4/4.) Or can I just
> av_hash_freep() each one in the array, regardsless?
>
>
Use freep and make sure that arrray holding other arrays is initialized to
0 upon allocation.


> Grateful for any other reviews,
> thanks,
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list