rte_pcapng_close() might dereference a null pointer; as example, PVS-Studio gives its usage in test_pcapng.c: indeed, that call to rte_pcapng_close() might receive a null pointer.
Link: https://pvs-studio.com/en/docs/warnings/v522/ Link: https://github.com/DPDK/dpdk/blob/e5176f23ae8b31437c3e5eb875c81f95bf3a9942/app/test/test_pcapng.c#L438 Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files") Signed-off-by: Ariel Otilibili <[email protected]> --- .mailmap | 2 +- lib/pcapng/rte_pcapng.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index a03d3cfb591b..ea68d6180ccc 100644 --- a/.mailmap +++ b/.mailmap @@ -135,7 +135,7 @@ Anupam Kapoor <[email protected]> Apeksha Gupta <[email protected]> Archana Muniganti <[email protected]> <[email protected]> Archit Pandey <[email protected]> -Ariel Otilibili <[email protected]> <[email protected]> +Ariel Otilibili <[email protected]> <[email protected]> Arkadiusz Kubalewski <[email protected]> Arkadiusz Kusztal <[email protected]> Arnaud Fiorini <[email protected]> diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c index 16485b27cb46..efd96a16ede7 100644 --- a/lib/pcapng/rte_pcapng.c +++ b/lib/pcapng/rte_pcapng.c @@ -716,6 +716,9 @@ rte_pcapng_fdopen(int fd, void rte_pcapng_close(rte_pcapng_t *self) { + if (!self) + return; + close(self->outfd); free(self); } -- 2.30.2

