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

Alexander Strasser eclipse7
Sun Aug 16 01:46:20 CEST 2009


Hi,

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.

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

[...]

  Alexander



More information about the ffmpeg-devel mailing list