[FFmpeg-devel] [PATCH] avdevice/dshow_enummediatypes: check return of av_malloc

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Nov 6 15:39:13 CET 2015


On Fri, Nov 6, 2015 at 7:25 AM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Sat, Oct 31, 2015 at 10:46:09AM -0400, Ganesh Ajjanagadde wrote:
>> On Wed, Oct 28, 2015 at 10:05 PM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
>> > On Wed, Oct 28, 2015 at 10:00 PM, Michael Niedermayer
>> > <michael at niedermayer.cc> wrote:
>> >> On Tue, Oct 27, 2015 at 08:09:03PM -0400, Ganesh Ajjanagadde wrote:
>> >>> Untested.
>> >>>
>> >>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> >>> ---
>> >>>  libavdevice/dshow_enummediatypes.c | 2 ++
>> >>>  1 file changed, 2 insertions(+)
>> >>>
>> >>> diff --git a/libavdevice/dshow_enummediatypes.c b/libavdevice/dshow_enummediatypes.c
>> >>> index 5b69a5b..5a24870 100644
>> >>> --- a/libavdevice/dshow_enummediatypes.c
>> >>> +++ b/libavdevice/dshow_enummediatypes.c
>> >>> @@ -37,6 +37,8 @@ libAVEnumMediaTypes_Next(libAVEnumMediaTypes *this, unsigned long n,
>> >>>      if (!this->pos && n == 1) {
>> >>>          if (!IsEqualGUID(&this->type.majortype, &GUID_NULL)) {
>> >>>              AM_MEDIA_TYPE *type = av_malloc(sizeof(AM_MEDIA_TYPE));
>> >>> +            if (!type)
>> >>> +                return AVERROR(ENOMEM);
>> >>
>> >> I cannot test this either but the surrounding code returns
>> >> E_POINTER, E_OUTOFMEMORY, ...
>> >> not AVERROR*
>> >> so this does not look correct, or at least inconsistent
>> >
>> > Looks like some Windows thing, I guess E_OUTOFMEMORY is the best
>> > choice. This needs to wait for a review from a Windows using dev IMO.
>>
>> Assuming the change from AVERROR(ENOMEM) to E_OUTOFMEMORY, is this
>> patch ok? Worst case, build should be guaranteed.
>
> should be ok

pushed, thanks

>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Complexity theory is the science of finding the exact solution to an
> approximation. Benchmarking OTOH is finding an approximation of the exact
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list