2011/4/27 Måns Rullgård <m...@mansr.com>: > "Ronald S. Bultje" <rsbul...@gmail.com> writes: > >> --- >> libavcodec/mpegvideo.c | 12 ++++++++++++ >> 1 files changed, 12 insertions(+), 0 deletions(-) >> >> diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c >> index c48b30f..48f25b3 100644 >> --- a/libavcodec/mpegvideo.c >> +++ b/libavcodec/mpegvideo.c >> @@ -520,6 +520,8 @@ av_cold int MPV_common_init(MpegEncContext *s) >> s->flags= s->avctx->flags; >> s->flags2= s->avctx->flags2; >> >> + if (s->width && s->height) { > > Why? malloc(0) is fine according to all standards. Presumably this > only happens in some degenerate case where performance is irrelevant, > but testing for it here imposes a (small) penalty on every case. >
Well the code is hardcoded to fail for for a valid non-error return value of malloc(0). We could add the overhead to FF_ALLOCZ_OR_GOTO() if you prefer. _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel