[FFmpeg-devel] [PATCH] warning fix for libswscale/swscale-example.c

Benoit Fouet benoit.fouet
Fri Mar 20 10:46:46 CET 2009


On 03/19/2009 12:06 PM, Benoit Fouet wrote:
> Hi,
>
> On 03/19/2009 11:23 AM, Diego Biurrun wrote:
>   
>> Here is a patch to fix or work around the following warnings:
>>
>> libswscale/swscale-example.c: In function 'main':
>> libswscale/swscale-example.c:60: warning: 'outContext' may be used uninitialized in this function
>> libswscale/swscale-example.c:60: warning: 'dstContext' may be used uninitialized in this function
>> libswscale/swscale-example.c:60: warning: 'srcContext' may be used uninitialized in this function
>>
>> Index: libswscale/swscale-example.c
>> ===================================================================
>> --- libswscale/swscale-example.c    (revision 28997)
>> +++ libswscale/swscale-example.c    (working copy)
>> @@ -59,6 +59,7 @@
>>      uint64_t ssdY, ssdU, ssdV;
>>      struct SwsContext *srcContext, *dstContext, *outContext;
>>      int res;
>> +    srcContext = dstContext = outContext = NULL;
>>
>>     
>
> this could be merged with the declarations.
> but this is definitely needed, indeed.
>
> BTW, even if not mentionned as a gcc warning, I think src, dst and out
> should be initialized too.
>
>   

as in the attached patch, or they could be freed while still uninitialized.

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: init_pointer_arrays.diff
Type: text/x-diff
Size: 684 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090320/680f6062/attachment.diff>



More information about the ffmpeg-devel mailing list