02/02/2018 19:47, Neil Horman: > On Fri, Feb 02, 2018 at 03:51:12PM +0000, Bruce Richardson wrote: > > On Fri, Feb 02, 2018 at 03:47:43PM +0000, Bruce Richardson wrote: > > > On Fri, Feb 02, 2018 at 07:44:39AM -0500, Neil Horman wrote: > > > > On Fri, Feb 02, 2018 at 12:00:58PM +0000, Bruce Richardson wrote: > > > > > Coverity flags an issue where the resources used by the FILE object > > > > > for > > > > > the temporary input file are leaked. This is a very minor issue, but > > > > > is > > > > > easily fixed, while also avoiding later problems where we try to close > > > > > an invalid file descriptor in the failure case. > > > > > > > > > > The fix is to use "dup()" to get a new file descriptor number rather > > > > > than > > > > > using the value directly from fileno. This allows us to close the file > > > > > opened with tmpfile() within in scope block, while allowing the > > > > > duplicate > > > > > to pass to the outer block and be closed when the function terminates. > > > > > > > > > > As a side-effect I/O in the function is therefore changed from using > > > > > stdio > > > > > fread/fwrite to read/write system calls. > > > > > > > > > > Coverity issue: 260399 > > > > > Fixes: 0d68533617e3 ("pmdinfogen: allow using stdin and stdout") > > > > > > > > > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> [...] > Acked-by: Neil Horman <nhor...@tuxdriver.com>
Applied, thanks