[x264-devel] Check malloc during frame dumping
Anton Mitrofanov
git at videolan.org
Sun Jul 20 11:58:31 CEST 2014
x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Jul 9 17:17:04 2014 +0400| [9e93d18b7fe7668f8277b5f117d7e39be24c6070] | committer: Fiona Glaser
Check malloc during frame dumping
> 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) );
- 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 );
+ 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 );
}
More information about the x264-devel
mailing list