diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-27 13:06:42 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-27 13:06:42 +0000 |
commit | 4a0a169a5dce1ffac685f3f7b2347f6619c52100 (patch) | |
tree | 3b4aaf191fc24c1548e442f489421cc495e0954b | |
parent | cad74ec91eb63f441ad9cea99cefb4824f666816 (diff) |
Fix a memory leak in an error path.
ok mikeb@
-rw-r--r-- | sys/dev/pv/hyperv.c | 4 |
1 files changed, 3 insertions, 1 deletions
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)) { |