[nas] [PATCH] Fix warnings about 'free' in nasd on GNU/Linux x86

Erik Auerswald auerswal at unix-ag.uni-kl.de
Fri Aug 16 13:40:27 MDT 2013


Hi,

On 08/16/2013 09:22 PM, Jon Trulson wrote:
> On Fri, 16 Aug 2013, Erik Auerswald wrote:
>> the attached patch fixes the following warnings about 'free' when
>> compiling NAS on GNU/Linux x86 (32 bit):
>>
>> ---8<---
>> uevents.c: In function ‘ProcessAudioEvents’:
>> auevents.c:149: warning: incompatible implicit declaration of built-in
>> function ‘free’
>> auevents.c: In function ‘AuDequeueEvents’:
>> auevents.c:249: warning: incompatible implicit declaration of built-in
>> function ‘free’
>> connection.c: In function ‘open_unix_socket’:
>> connection.c:585: warning: incompatible implicit declaration of
>> built-in function ‘free’
>> connection.c:608: warning: incompatible implicit declaration of
>> built-in function ‘free’
>> ---8<---
>>
>> Please review and test the changes. Testing on different operating
>> systems
>> and/or different architectures would be nice.
>>
>> I intend to apply the patch over the weekend unless somebody objects. :-)
>
> I object your honor! :)
>
> This is rather strange.  Including stdlib.h should be the correct fix.

Indeed.

> I did this, and it seems to work, but saw two other warnings that are
> worrisome:
>
> =-=-=-=-
> connection.c: In function ‘AuthAudit’:
> connection.c:1328:27: warning: format ‘%s’ expects argument of type
> ‘char *’, but argument 4 has type ‘int’ [-Wformat]
> connection.c:1328:27: warning: format ‘%s’ expects argument of type
> ‘char *’, but argument 4 has type ‘int’ [-Wformat]
> =-=-=-=-
>
> This is basically inet_ntoa() returning an int, rather than the string
> it should be returning.  This is coredump material on x86_64, so
> clearly this function (in addition to free()) is not being prototyped
> properly either.

I have seen a lot of warnings on 64 bit Ubuntu 12.04, but have not yet 
checked them.

> Attached is my suggested patch that should resolve both issues on
> linux at least.  Could you try it on your 32b machine?

Works for me on 32 bit Debian and 64 bit Ubuntu machines. :-)

Thanks,
Erik


More information about the nas mailing list