vfio: fix read of freed memory on getting container fd

We were reading some memory just after freeing it.

Fixes: 83a73c5fef ("vfio: use generic multi-process channel")
Cc: stable@dpdk.org

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-10-25 12:49:10 +02:00 committed by Thomas Monjalon
parent 4f5519ed83
commit 88e2d78a20

View File

@ -1042,8 +1042,9 @@ rte_vfio_get_container_fd(void)
mp_rep = &mp_reply.msgs[0];
p = (struct vfio_mp_param *)mp_rep->param;
if (p->result == SOCKET_OK && mp_rep->num_fds == 1) {
vfio_container_fd = mp_rep->fds[0];
free(mp_reply.msgs);
return mp_rep->fds[0];
return vfio_container_fd;
}
free(mp_reply.msgs);
}