From 424f57123c4d022ef633aad468350d1de328b8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 24 Aug 2010 22:58:08 +0000 Subject: [PATCH] pci: Fix memory leaks in uninorth (ppc) The future cookie was leaked in three of four error scenarios. Backported from grackle. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38345 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/bus_managers/pci/arch/ppc/openfirmware/uninorth.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/pci/arch/ppc/openfirmware/uninorth.cpp b/src/add-ons/kernel/bus_managers/pci/arch/ppc/openfirmware/uninorth.cpp index bc59cfb409..d7a1f4c0ea 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/ppc/openfirmware/uninorth.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/ppc/openfirmware/uninorth.cpp @@ -243,6 +243,7 @@ ppc_openfirmware_probe_uninorth(int deviceNode, if (bytesRead < 0) { dprintf("ppc_openfirmware_probe_uninorth: Could not get ranges.\n"); + free(bridge); return B_ERROR; } bridge->range_count = bytesRead / sizeof(uninorth_range); @@ -269,11 +270,13 @@ ppc_openfirmware_probe_uninorth(int deviceNode, if (ioRange == NULL) { dprintf("ppc_openfirmware_probe_uninorth: Can't find io range.\n"); + free(bridge); return B_ERROR; } if (memoryRangeCount == 0) { dprintf("ppc_openfirmware_probe_uninorth: Can't find mem ranges.\n"); + free(bridge); return B_ERROR; }