nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] File descriptor leak in mhfixmsg?

2019-12-26 16:35:47
Conrad writes:

It *looks* to me as if the declaration in mhfixmsgsbr() that outfp will
be closed by its caller is not strictly true: if I understand correctly,
a new file is opened every time the cts/ctp loop on line 540 iterates,
where the only *close* is a singular one on line 564.  Adding a line 554
along the lines of

  if (outfp) { fclose (outfp); outfp = NULL; }

.. appears to solve things for me without breaking any tests;

Fix committed, thank you!

Seems
*possible* there was a no-longer-relevant design decision to relinquish
control over outfp, and it could perhaps now be closed in mhfixmsgsbr()?

The idea was to allow mhfixmsgsbr() to be callable by other programs.  It
in fact isn't, but that's consistent with other MH usage of having the
main program call a sbr.

David

<Prev in Thread] Current Thread [Next in Thread>