From a957e4c978fd3800d03a1355fac7880ad407a2c2 Mon Sep 17 00:00:00 2001 From: Waldemar Kornewald Date: Tue, 18 Oct 2005 18:35:13 +0000 Subject: [PATCH] Fixed a bug and memory leak in PPPManager. Added *very* naive semaphore-deletion detection code to ethernet module (fixes crashing bug on unload). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14409 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/interfaces/ethernet/ethernet.c | 7 +++++-- src/add-ons/kernel/network/interfaces/ppp/PPPManager.cpp | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/network/interfaces/ethernet/ethernet.c b/src/add-ons/kernel/network/interfaces/ethernet/ethernet.c index 049d46a31f..21a55ace80 100644 --- a/src/add-ons/kernel/network/interfaces/ethernet/ethernet.c +++ b/src/add-ons/kernel/network/interfaces/ethernet/ethernet.c @@ -377,10 +377,13 @@ int32 ether_input(void *data) struct mbuf *m; struct ether_header *eth; int len; + status_t error = B_OK; while (1) { len = sizeof(struct ether_header); - acquire_sem_etc(etherq->pop, 1, B_CAN_INTERRUPT, 0); + error = acquire_sem_etc(etherq->pop, 1, B_CAN_INTERRUPT, 0); + if(error != B_NO_ERROR) + return error; IFQ_DEQUEUE(etherq, m); if (!m) continue; @@ -428,7 +431,7 @@ int32 ether_input(void *data) } } - return 0; + return error; } #define senderr(e) { error = (e); goto bad; } diff --git a/src/add-ons/kernel/network/interfaces/ppp/PPPManager.cpp b/src/add-ons/kernel/network/interfaces/ppp/PPPManager.cpp index 0e09335d63..c321012102 100644 --- a/src/add-ons/kernel/network/interfaces/ppp/PPPManager.cpp +++ b/src/add-ons/kernel/network/interfaces/ppp/PPPManager.cpp @@ -93,9 +93,11 @@ PPPManager::~PPPManager() app = fApps.ItemAt(index); if(app) { free(app->interfaceName); - delete entry; + delete app; } } + + free(fDefaultInterface); }