diff options
author | 2016-06-27 13:06:41 +0000 | |
---|---|---|
committer | 2016-06-27 13:06:41 +0000 | |
commit | 3c184ea24805722634a8684e3fc7dd05bf8fb426 (patch) | |
tree | 6b730e9b7a57dedd37291e307374802d8fceece9 | |
parent | Correct the order of memset arguments. (diff) | |
download | wireguard-openbsd-3c184ea24805722634a8684e3fc7dd05bf8fb426.tar.xz wireguard-openbsd-3c184ea24805722634a8684e3fc7dd05bf8fb426.zip |
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)) { |