[systemd-devel] misuse of _cleanup_free_ in bus_message_from_header() ?

Daniel Mack daniel at zonque.org
Tue Sep 1 02:33:13 PDT 2015


On 09/01/2015 10:58 AM, eshark wrote:
> Hi, All,
> 
>        I found that in bus-message.c  , the  bus_message_from_header() seems to misuse the _cleanup_free_ ,
> 
>        int bus_message_from_header()
>        {
>                
>              _cleanup_free_  sd_bus_message *m = NULL;
>       ==>


This function allocates a new message with malloc0(), so calling free()
on that variable is the right thing to do on errors. What makes you
believe this isn't correct?


Daniel



More information about the systemd-devel mailing list