[systemd-devel] [systemd PATCH 2/2] Fix file descriptor leak in efi_get_variable()

Thomas Jarosch thomas.jarosch at intra2net.com
Mon Jan 28 00:18:23 PST 2013


On Friday, 25. January 2013 16:58:48 Lennart Poettering wrote:
> > -        if (fstat(fd, &st) < 0)
> > +        if (fstat(fd, &st) < 0) {
> > +                close_nointr_nofail(fd);
> 
> I figure cppcheck needs to learn about _cleanup_close_... We use gcc's
> cleanup attribute logic to close this file. In fact we make use of that
> quite heavily now for memory and other kind of resourec allocation....

Thanks for the hint, I'll take care of that. I wasn't even aware about the 
_cleanup_close stuff so my eyes skipped it while reading ;)

Thomas



More information about the systemd-devel mailing list