[systemd-devel] [PATCH 0/5] Coverity fixes

Mantas Mikulėnas grawity at gmail.com
Wed Sep 10 03:30:37 PDT 2014


On Wed, Sep 10, 2014 at 1:20 PM, Philippe De Swert
<philippedeswert at gmail.com> wrote:
>
> Hi,
>
> On 10/09/14 13:12, Thomas H.P. Andersen wrote:> On Wed, Sep 10, 2014 at
> 11:20 AM,  <philippedeswert at gmail.com> wrote:
> >> Yesterday I finally got to revive the systemd Coverity project on
> >> scan.coverity.org Unfortunately to see the errors reported you need
> >> to sign up, but I will make sure to approve requests for seeing the
> >> "bugs" whenever they show up.
> >
> > Nice! I regularly run llvm's static analyzer and fix the issues it
> > finds. It seems that coverity finds different/more issues. I have sent
> > a request to help review those bugs.
>
> Already approved ;)
>
>
> On a side note I noticed this mail :
> http://permalink.gmane.org/gmane.comp.sysutils.systemd.devel/6248
>
> Talking about some freeing macros. I noticed there seem to be some
> here and there. So it would be good to know what they are. As a lot
> of the errors seem to be leaking fd's and the like.

gcc has a "cleanup" attribute for variables, which makes the compiler
automatically add a call to the specified function as soon as the
variable goes out of scope.

systemd uses this liberally, and has convenience macros like
_cleanup_close_ to automatically close fd's when returning from a
function, so they don't actually leak when declared like that.

The message you linked to actually describes exactly this...

-- 
Mantas Mikulėnas <grawity at gmail.com>


More information about the systemd-devel mailing list