[FFmpeg-devel] [PATCH] Fix ffserver.c putenv gcc warning

Baptiste Coudurier baptiste.coudurier
Mon Jun 2 23:51:53 CEST 2008


Hi,

Stefano Sabatini wrote:
> On date Friday 2008-05-30 17:21:34 +0100, M?ns Rullg?rd encoded:
>> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
>>
>>> Hi all,
>>>
>>> putenv expects a char* when we feed it with a const char*, this fixes
>>> the resulting warning:
>>> ffserver.c: In function ?main?:
>>> ffserver.c:4388: warning: passing argument 1 of ?putenv? discards qualifiers from pointer target type
> [...]
> 
>>> Index: ffserver.c
>>> ===================================================================
>>> --- ffserver.c	(revision 13552)
>>> +++ ffserver.c	(working copy)
>>> @@ -4385,7 +4385,7 @@
>>>  
>>>      parse_options(argc, argv, options, NULL);
>>>  
>>> -    putenv("http_proxy");               /* Kill the http_proxy */
>>> +    putenv(av_strdup("http_proxy"));    /* Kill the http_proxy */
>> Beautiful memory leak.
> 
> Hi.
> 
> Is a string left on the heap really a problem? also the alternative
> solution (attached) looks quite ugly, also keeping the warning doesn't
> look like a nice solution.
> 

What about using unsetenv ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc.                                http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA




More information about the ffmpeg-devel mailing list