[libcamera-devel] [PATCH 3/4] test: log: log_api: Close open fds on error paths
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Apr 14 15:46:59 CEST 2020
Hi Umang,
On Tue, Apr 14, 2020 at 01:38:26PM +0000, Umang Jain wrote:
> On Tue, Apr 14, 2020 at 12:29, Kieran Bingham wrote:
> >
> > Looking at testFile(), doesn't the fd also leak after the call to
> > logSetFile(path) if that fails?
> >
> > If there is the same issue in multiple places in a function I think it
> > should be handled by a single patch.
>
> Ah yes, nice catch. I missed to notice that.
>
> > It would be nice of course if these releases could be handled
> > automatically - so perhaps converting things to use FileDescriptor
> > classes might help, though an initial glance looks like that will
> > always
> > dup() the FD which might not be particularly desirable ...
> >
> > I'll leave it to you to decide, either rework to convert to
> > FileDescriptor objects on a per-test basis, or just do a v2 of this
> > patch with all paths fixed, perhaps for now just fixing this would
> > make
> > coverity happy :-)
>
> I prefer to do a v2 of this patch right now. I think that porting
> tests/ to use FileDescriptor itself is a self-contained task and
> should deserve a entire patchset. We need to first investigate and
> analyze a bit, as Laurent mentioned previously and extend
> FileDescriptor class (if required at the first place).
I agree with you for this patch. For 2/4, however, I'd like to move to
FileDescriptor.
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list