From 3c184ea24805722634a8684e3fc7dd05bf8fb426 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 27 Jun 2016 13:06:41 +0000 Subject: [PATCH] Fix a memory leak in an error path. ok mikeb@ --- sys/dev/pv/hyperv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/pv/hyperv.c b/sys/dev/pv/hyperv.c index 16d2d18413d..d99d9f8f29d 100644 --- a/sys/dev/pv/hyperv.c +++ b/sys/dev/pv/hyperv.c @@ -1487,8 +1487,10 @@ hv_handle_alloc(struct hv_channel *ch, void *buffer, uint32_t buflen, /* Prepare array of frame addresses */ if ((frames = mallocarray(total, sizeof(*frames), M_DEVBUF, M_ZERO | - waitok)) == NULL) + waitok)) == NULL) { + free(msg, M_DEVBUF, sizeof(*msg)); return (ENOMEM); + } for (i = 0; i < total; i++) { if (!pmap_extract(pmap_kernel(), (vaddr_t)buffer + PAGE_SIZE * i, &pa)) { -- 2.20.1