[FFmpeg-devel] [PATCH] Check malloc values in swscale.

Ramiro Polla ramiro.polla
Sun Aug 16 02:15:30 CEST 2009


On Sat, Aug 15, 2009 at 8:46 PM, Alexander Strasser<eclipse7 at gmx.net> wrote:
> Ramiro Polla wrote:
> [...]
>> +SwsVector *sws_allocVec(int length)
>> +{
>> + ? ?SwsVector *vec = av_malloc(sizeof(SwsVector));
>> + ? ?double *coeff ?= av_malloc(sizeof(double) * length);
>> + ? ?if (!coeff | !vec) {
>> + ? ? ? ?av_free(coeff);
>> + ? ? ? ?av_free(vec);
>> + ? ? ? ?return NULL;
>> + ? ?}
>> + ? ?vec->length = length;
>> + ? ?vec->coeff ?= coeff;
>> + ? ?return vec;
>> +}
>
> ?was the switch to bitwise or in the if intentional? Not that
> the result would change in this case, but I think || would be
> more clear in this case.

It was not intentional...

> ?Anyway, as Reimar already suggested you might end up rewriting
> the routine. Just wanted to point it out, if it slipped through.

Right. I wanted to do things one step at a time, but then I started
getting a review on the code that was already there, so I'll just send
a patchset when I'm done with everything.

Ramiro Polla



More information about the ffmpeg-devel mailing list