From 2fa4f595eebf3470ac0f6d32c4958dec679958c8 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Wed, 4 Dec 2019 13:37:53 -0800 Subject: [PATCH] Don't crash with a null device pointer --- utils/mqnic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/mqnic.c b/utils/mqnic.c index 3f4694dc4..3c3652d03 100644 --- a/utils/mqnic.c +++ b/utils/mqnic.c @@ -173,6 +173,9 @@ fail_alloc: void mqnic_close(struct mqnic *dev) { + if (!dev) + return; + munmap((void *)dev->regs, dev->regs_size); close(dev->fd); free(dev);