[systemd-devel] [PATCH 1/5] fsckd: Don't use strjoina on gettext() call

Didier Roche didrocks at ubuntu.com
Wed Mar 11 06:25:53 PDT 2015


Le 11/03/2015 09:34, Didier Roche a écrit :
> Le 11/03/2015 09:29, Martin Pitt a écrit :
>> Hello all,
>>
>> Didier Roche [2015-03-10 17:56 +0100]:
>>> --- a/src/fsckd/fsckd.c
>>> +++ b/src/fsckd/fsckd.c
>>> @@ -272,7 +272,7 @@ static int plymouth_send_message(int 
>>> plymouth_fd, const char *message, bool upda
>>>   }
>>>     static int manager_send_plymouth_message(Manager *m, const char 
>>> *message) {
>>> -        const char *plymouth_cancel_message = NULL;
>>> +        _cleanup_free_ const char *plymouth_cancel_message = NULL, 
>>> *l10n_cancel_message = NULL;
>>>           int r;
>> As far as I can see, this would free(l10n_cancel_message) on exit, but
>> you must never free the result of gettext(). So split this into
>>
>>    _cleanup_free_ const char *plymouth_cancel_message = NULL;
>>    const char *l10n_cancel_message;
>
> Indeed (weird I didn't get a double free crash), but the man page says 
> it's statically allocated. Will fix it and report while bringing up 
> the other patch with the architecture modification.
> Thanks!

Actually, none of then needed a cleanup_free as the second is a strjoina().

Here is the updated patch, thanks!
Didier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fsckd-Don-t-use-strjoina-on-gettext-call.patch
Type: text/x-diff
Size: 1423 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150311/28a83c32/attachment-0001.patch>


More information about the systemd-devel mailing list