[SSSD] [PATCHES] Two resource leaks discovered by coverity

Jan Zeleny jzeleny at redhat.com
Fri Nov 4 16:11:41 UTC 2011


Stephen Gallagher <sgallagh at redhat.com> wrote:
> On Fri, 2011-11-04 at 11:55 +0100, Jakub Hrozek wrote:
> > On Fri, Nov 04, 2011 at 11:43:02AM +0100, Jan Zeleny wrote:
> > > Jakub Hrozek <jhrozek at redhat.com> wrote:
> > > > On Fri, Nov 04, 2011 at 09:24:55AM +0100, Jan Zeleny wrote:
> > > > > https://fedorahosted.org/sssd/ticket/1069
> > > > > https://fedorahosted.org/sssd/ticket/1071
> > > > > 
> > > > > --
> > > > > Jan
> > > > 
> > > > 001: ack
> > > > 002: nack, if talloc_asprintf() failed, close() would attempt to
> > > > close a random-valued fd
> > > 
> > > Ah, you're right. Similar situation would occur if open() failed.
> > > 
> > > The second round of patches attached
> > > 
> > > Jan
> > 
> > It would be more readable to initialize fd to -1 or any value < 0 and
> > only close if (fd != -1) but this works too, I guess.
> 
> I'm going to say that Jakub's suggestion justifies a nack. It would be
> much better going forward if we just initialized to -1 and had the
> 'fail' label simply check for (fd >= 0)

Agreed. Sending corrected patch.

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jzeleny-066-Fixed-possible-resource-leak-in-get_uid_from_pid.patch
Type: text/x-patch
Size: 1735 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20111104/5cf77a28/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jzeleny-067-2-Fixed-possible-resource-leak-in-create_mail_spool.patch
Type: text/x-patch
Size: 1594 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20111104/5cf77a28/attachment-0001.bin>


More information about the sssd-devel mailing list