From: jsg Date: Mon, 27 Jun 2016 13:06:41 +0000 (+0000) Subject: Fix a memory leak in an error path. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3c184ea24805722634a8684e3fc7dd05bf8fb426;p=openbsd Fix a memory leak in an error path. ok mikeb@ --- 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)) {