Commit 4a3e072e authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Fiona Glaser

Fix malloc of zero size

Caused x264 to fail with some settings on systems that return a NULL pointer for malloc(0), like Solaris.
parent f0b8dd33
......@@ -340,7 +340,10 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
}
int buf_mbtree = h->param.rc.b_mb_tree * ((h->mb.i_mb_width+3)&~3) * sizeof(int);
scratch_size = X264_MAX( scratch_size, buf_mbtree );
CHECKED_MALLOC( h->scratch_buffer, scratch_size );
if( scratch_size )
CHECKED_MALLOC( h->scratch_buffer, scratch_size );
else
h->scratch_buffer = NULL;
return 0;
fail:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment