numam-dpdk/buildtools
Bruce Richardson ac7f4af813 pmdinfogen: fix resource leak of file object
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: 0d68533617 ("pmdinfogen: allow using stdin and stdout")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2018-02-06 01:15:14 +01:00
..
pmdinfogen pmdinfogen: fix resource leak of file object 2018-02-06 01:15:14 +01:00
auto-config-h.sh buildtools: fix icc build 2017-11-06 21:43:04 +01:00
check-experimental-syms.sh buildtools: add script to check experimental API exports 2018-01-29 22:44:00 +01:00
gen-build-mk.sh tools: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
gen-config-h.sh tools: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
gen-pmdinfo-cfile.sh drivers: improve pmdinfo generation with meson 2018-01-30 21:59:00 +01:00
Makefile pmdinfogen: add buildtools and pmdinfogen utility 2016-07-06 22:34:39 +02:00
meson.build build: replace license text with SPDX tag 2018-01-30 21:58:59 +01:00
relpath.sh tools: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
symlink-drivers-solibs.sh build: replace license text with SPDX tag 2018-01-30 21:58:59 +01:00