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

Michael Niedermayer michaelni
Sun Aug 16 17:12:03 CEST 2009


On Sat, Aug 15, 2009 at 06:30:38PM +0200, Reimar D?ffinger wrote:
> On Sat, Aug 15, 2009 at 12:03:32PM -0300, Ramiro Polla wrote:
[...]
> >  SwsVector *sws_getConstVec(double c, int length){
> >      int i;
> > -    double *coeff= av_malloc(length*sizeof(double));
> > -    SwsVector *vec= av_malloc(sizeof(SwsVector));
> > -
> > -    vec->coeff= coeff;
> > -    vec->length= length;
> > +    SwsVector *vec= sws_allocVec(length);
> >  
> >      for (i=0; i<length; i++)
> > -        coeff[i]= c;
> > +        vec->coeff[i]= c;
> 
> Possible optimization: use memset if c == 0

i dont think this code is used anywhere except during init so the
complexity of optimizations isnt worth it

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090816/c65f8d3d/attachment.pgp>



More information about the ffmpeg-devel mailing list