Aℓex Converse <[email protected]> writes:

> 2011/4/27 Måns Rullgård <[email protected]>:
>> "Ronald S. Bultje" <[email protected]> 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).

Good point.  I guess the patch is OK then.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to