[libcamera-devel] [PATCH 3/4] test: log: log_api: Close open fds on error paths

Umang Jain email at uajain.com
Tue Apr 14 15:38:26 CEST 2020


Hi Kieran,

On Tue, Apr 14, 2020 at 12:29, Kieran Bingham 
<kieran.bingham at ideasonboard.com> 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).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200414/2aa4ade7/attachment.htm>


More information about the libcamera-devel mailing list