diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2015-10-04 07:56:51 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2015-10-04 07:56:51 +0000 |
commit | 306ba9c92fbf5e3b4bc8ed389789dc9d1e96fe76 (patch) | |
tree | e29ab3bd40354beed1f8e379ff66416d307ffc3f /sys | |
parent | 154aedb0893a6cb068329818dc732e8cf61f467d (diff) |
Fix memory leak in error path.
From Benjamin Baier, found by llvm/scan-build.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ahci.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index 2f98e1f0382..9f6c596f3ab 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.22 2015/08/27 18:47:29 deraadt Exp $ */ +/* $OpenBSD: ahci.c,v 1.23 2015/10/04 07:56:50 jmatthew Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -460,7 +460,8 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port) if (ap->ap_err_scratch == NULL) { printf("%s: unable to allocate DMA scratch buf for port %d\n", DEVNAME(sc), port); - goto freeport; + free(ap, M_DEVBUF, sizeof(*ap)); + goto reterr; } #ifdef AHCI_DEBUG |