[x264-devel] Check malloc during frame dumping

Igor Mozolevsky igor at hybrid-lab.co.uk
Sun Jul 20 12:05:40 CEST 2014


On 20 July 2014 10:58, Anton Mitrofanov <git at videolan.org> wrote:

>
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=9e93d18b7fe7668f8277b5f117d7e39be24c6070
> ---
>
>  encoder/encoder.c |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/encoder/encoder.c b/encoder/encoder.c
> index bd26a9f..5305f75 100644
> --- a/encoder/encoder.c
> +++ b/encoder/encoder.c
> @@ -97,11 +97,14 @@ static void x264_frame_dump( x264_t *h )
>          int cw = h->param.i_width>>1;
>          int ch = h->param.i_height>>CHROMA_V_SHIFT;
>          pixel *planeu = x264_malloc( (cw*ch*2+32)*sizeof(pixel) );
> +        if( planeu )
> +        {
> +            pixel *planev = planeu + cw*ch + 16;
> +            h->mc.plane_copy_deinterleave( planeu, cw, planev, cw,
> h->fdec->plane[1], h->fdec->i_stride[1], cw, ch );
> +            fwrite( planeu, 1, cw*ch*sizeof(pixel), f );
> +            fwrite( planev, 1, cw*ch*sizeof(pixel), f );
> +            x264_free( planeu );
> +        }
>      }
>      fclose( f );
>  }
>



Is this intended to be fail-silent?


-- 
Igor M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20140720/323b0413/attachment.html>


More information about the x264-devel mailing list