From 68d14d3dada99517670b831378b34ef3984fce37 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Mon, 5 Mar 2018 03:31:40 +0000 Subject: fix a memory leak in readdoslabel() ok krw@ --- sys/kern/subr_disk.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'sys') diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 093c3458c73..f9a8d97cc85 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.232 2017/08/07 11:50:58 kettenis Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.233 2018/03/05 03:31:39 jsg Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -387,15 +387,12 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), if (error == 0) { dospartoff = DL_GETBSTART(gptlp); dospartend = DL_GETBEND(gptlp); - if (partoffp) { - if (dospartoff == 0) - return (ENXIO); - else - goto notfat; - } - *lp = *gptlp; + if (partoffp == 0) + *lp = *gptlp; free(gptlp, M_DEVBUF, sizeof(struct disklabel)); + if (partoffp && dospartoff == 0) + return (ENXIO); goto notfat; } else { free(gptlp, M_DEVBUF, -- cgit v1.2.3