From: krw Date: Wed, 20 Jul 2016 20:45:13 +0000 (+0000) Subject: Plug potential leak of device list. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=28fda83805ec3f7402b04e894723fcc023f3ace5;p=openbsd Plug potential leak of device list. Problem found by Michael McConville. Tested & ok stsp@ --- diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index d66adb6d658..679162fbd22 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.376 2016/05/31 15:19:12 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.377 2016/07/20 20:45:13 krw Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom * Copyright (c) 2008 Chris Kuethe @@ -3313,7 +3313,7 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, struct scsi_link *link; struct device *dev; char *uuid, devname[32]; - dev_t *dt; + dev_t *dt = NULL; int i, no_chunk, rv = EINVAL, target, vol; int no_meta; @@ -3586,9 +3586,13 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, sd->sd_ready = 1; + free(dt, M_DEVBUF, bc->bc_dev_list_len); + return (rv); unwind: + free(dt, M_DEVBUF, bc->bc_dev_list_len); + sr_discipline_shutdown(sd, 0); if (rv == EAGAIN)