From 8379bbf6cbdb4efbbe5fb9eb881b8d3267eb285d Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 28 Oct 2014 01:41:40 +0000 Subject: [PATCH] Don't use freed memory. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49727 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/hidds/ata_pci/ata_pci.conf | 2 +- rom/hidds/ata_pci/probe.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rom/hidds/ata_pci/ata_pci.conf b/rom/hidds/ata_pci/ata_pci.conf index 8baacd9b0f..524d82d4fe 100644 --- a/rom/hidds/ata_pci/ata_pci.conf +++ b/rom/hidds/ata_pci/ata_pci.conf @@ -1,6 +1,6 @@ ##begin config basename PCIATA -version 1.1 +version 1.2 libbase base libbasetype struct ataBase classptr_field busClass diff --git a/rom/hidds/ata_pci/probe.c b/rom/hidds/ata_pci/probe.c index 34f0a95715..e9518b4873 100644 --- a/rom/hidds/ata_pci/probe.c +++ b/rom/hidds/ata_pci/probe.c @@ -1,5 +1,5 @@ /* - Copyright © 2004-2013, The AROS Development Team. All rights reserved. + Copyright © 2004-2014, The AROS Development Team. All rights reserved. $Id$ Desc: Hardware detection routine @@ -183,11 +183,11 @@ AROS_UFH3(void, ata_PCIEnumerator_h, /* * SATA controllers may need a special treatment before becoming usable. * The machine's firmware (EFI on Mac) may operate them in native AHCI mode - * and do not set up legacy mode by itself. + * and not set up legacy mode by itself. * In this case we have to do it ourselves. * This code is based on incomplete ahci.device source code by DissyOfCRN. * CHECKME: In order to work on PPC it uses explicit little-endian I/O, - * assuning AHCI register file is always little-endian. Is it correct ? + * assuming AHCI register file is always little-endian. Is it correct? */ if (SubClass == PCI_SUBCLASS_SATA) { @@ -306,7 +306,7 @@ AROS_UFH3(void, ata_PCIEnumerator_h, /* * we can have up to two buses assigned to this device */ - for (x = 0; x < MAX_DEVICEBUSES; x++) + for (x = 0; devRef != NULL && x < MAX_DEVICEBUSES; x++) { BYTE basePri = ATABUSNODEPRI_PROBED; @@ -399,7 +399,10 @@ AROS_UFH3(void, ata_PCIEnumerator_h, } if (!devRef->ref_Count) + { DeviceFree(devRef, base); + devRef = NULL; + } } AROS_USERFUNC_EXIT -- 2.11.4.GIT