[FFmpeg-cvslog] r9434 - trunk/libavcodec/imgresample.c

Benoit Fouet benoit.fouet
Tue Jun 26 20:03:49 CEST 2007


ods15 at ods15.dyndns.org wrote:
> On Tue, Jun 26, 2007 at 06:09:56PM +0200, benoit wrote:
>   
>> Author: benoit
>> Date: Tue Jun 26 18:09:55 2007
>> New Revision: 9434
>>
>> Log:
>> add an AVClass pointer in SwsContext context
>>
>>
>> Modified:
>>    trunk/libavcodec/imgresample.c
>>
>> Modified: trunk/libavcodec/imgresample.c
>> ==============================================================================
>> --- trunk/libavcodec/imgresample.c	(original)
>> +++ trunk/libavcodec/imgresample.c	Tue Jun 26 18:09:55 2007
>> @@ -44,6 +44,7 @@
>>  #define LINE_BUF_HEIGHT (NB_TAPS * 4)
>>  
>>  struct SwsContext {
>> +    AVClass *av_class;
>>      struct ImgReSampleContext *resampling_ctx;
>>      enum PixelFormat src_pix_fmt, dst_pix_fmt;
>>  };
>> @@ -642,7 +643,8 @@ struct SwsContext *sws_getContext(int sr
>>      struct SwsContext *ctx;
>>  
>>      ctx = av_malloc(sizeof(struct SwsContext));
>> -    if (ctx == NULL) {
>> +    ctx->av_class = av_mallocz(sizeof(AVClass));
>> +    if (!ctx || !ctx->av_class) {
>>          av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");
>>     
>
> Wanted to reply to the -devel message when this patch was attached but 
> didn't get a chance - note the usage of memory BEFORE the check if the 
> allocation succeeded... 'ctx->av_class' before 'ctx' is checked for being 
> NULL...
>
>   

thought about it while coming home too :)
this is fixed

thanks anyway

Ben





More information about the ffmpeg-cvslog mailing list