eal/bsd: fix possible IOPL fd leak
If rte_eal_iopl_init() will be called more than once we'll leak
the file descriptor.
Fixes: b46fe31862
("eal/bsd: fix virtio on FreeBSD")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
8747682a69
commit
9e8b90fc6d
@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void)
|
||||
int
|
||||
rte_eal_iopl_init(void)
|
||||
{
|
||||
static int fd;
|
||||
static int fd = -1;
|
||||
|
||||
if (fd < 0)
|
||||
fd = open("/dev/io", O_RDWR);
|
||||
|
||||
fd = open("/dev/io", O_RDWR);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
/* keep fd open for iopl */
|
||||
|
Loading…
Reference in New Issue
Block a user