hrev52340 adds 1 changeset to branch 'master'
old head: 45bc01d2f71686b254d97ce04701c413d31cc76b
new head: 043b00fb2c5764c3aab40ae788440f27a4b1030f
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=043b00fb2c57+%5E45bc01d2f716
----------------------------------------------------------------------------
043b00fb2c57: BNetworkDevice: Fix memory leaks and address comments.
Thanks Axel and Jerome for the reviews!
Change-Id: I4f116c540cf59ba74b79d9d2f95ed40edc9c4174
Reviewed-on: https://review.haiku-os.org/557
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev52340
Commit: 043b00fb2c5764c3aab40ae788440f27a4b1030f
URL: https://git.haiku-os.org/haiku/commit/?id=043b00fb2c57
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Thu Sep 13 19:51:18 2018 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Sep 13 19:53:33 2018 UTC
----------------------------------------------------------------------------
1 file changed, 9 insertions(+), 3 deletions(-)
src/kits/network/libnetapi/NetworkDevice.cpp | 12 +++++++++---
----------------------------------------------------------------------------
diff --git a/src/kits/network/libnetapi/NetworkDevice.cpp
b/src/kits/network/libnetapi/NetworkDevice.cpp
index f823e87bdb..7cd7b46fbd 100644
--- a/src/kits/network/libnetapi/NetworkDevice.cpp
+++ b/src/kits/network/libnetapi/NetworkDevice.cpp
@@ -12,8 +12,8 @@
#include <stdio.h>
#include <sys/sockio.h>
-#include <Messenger.h>
#include <Looper.h>
+#include <Messenger.h>
#include <AutoDeleter.h>
#include <NetServer.h>
@@ -741,6 +741,8 @@ BNetworkDevice::Scan(bool wait, bool forceRescan)
BString interfaceName;
if (message->FindString("interface", &interfaceName) !=
B_OK)
return;
+ // See comment in
AutoconfigLooper::_NetworkMonitorNotification
+ // for the reason as to why we use FindFirst instead of
==.
if (fInterface.FindFirst(interfaceName) < 0)
return;
if (message->FindInt32("opcode") !=
B_NETWORK_WLAN_SCANNED)
@@ -788,11 +790,15 @@ BNetworkDevice::Scan(bool wait, bool forceRescan)
// If there is already a scan currently running, it's probably an
"infinite"
// one, which we of course don't want to wait for. So just return
immediately
// if that's the case.
- if (status == EINPROGRESS)
+ if (status == EINPROGRESS) {
+ delete listener;
return B_OK;
+ }
- if (!wait || status != B_OK)
+ if (!wait || status != B_OK) {
+ delete listener;
return status;
+ }
while (wait_for_thread(listener->Run(), NULL) == B_INTERRUPTED)
;