From 812f008676a6d7f7af970e778744a64cffc8eb64 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Fri, 26 Feb 2010 12:09:53 -0800 Subject: [PATCH 1/2] Bug 548177 followup - missed one line, see comment 3. --- config/autoconf.mk.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index b8f00fd1ee91..2c9cc47f2220 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -89,8 +89,6 @@ MOZ_X11 = @MOZ_X11@ MOZ_PANGO = @MOZ_PANGO@ -MOZ_CORETEXT = @MOZ_CORETEXT@ - MOZ_JS_LIBS = @MOZ_JS_LIBS@ MOZ_DEBUG = @MOZ_DEBUG@ From 69c778877c442cfb60d3df8371136e2655434361 Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Fri, 26 Feb 2010 14:18:12 -0600 Subject: [PATCH 2/2] Fix memory leaks in Mac OS X CoreWLAN code. b=548796 r=smichaud --- netwerk/wifi/src/osx_corewlan.mm | 34 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/netwerk/wifi/src/osx_corewlan.mm b/netwerk/wifi/src/osx_corewlan.mm index ad43d9573f24..461d0f44539f 100644 --- a/netwerk/wifi/src/osx_corewlan.mm +++ b/netwerk/wifi/src/osx_corewlan.mm @@ -43,6 +43,7 @@ #include #include +#include "nsObjCExceptions.h" #include "nsAutoPtr.h" #include "nsCOMArray.h" #include "nsWifiMonitor.h" @@ -59,36 +60,43 @@ BOOL UsingSnowLeopard() { nsresult GetAccessPointsFromWLAN(nsCOMArray &accessPoints) { + NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; + if (!UsingSnowLeopard()) return NS_ERROR_NOT_AVAILABLE; accessPoints.Clear(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - @try { - NSBundle * bundle = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/CoreWLAN.framework"]; - if (!bundle) + @try { + NSBundle * bundle = [[[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/CoreWLAN.framework"] autorelease]; + if (!bundle) { + [pool release]; return NS_ERROR_NOT_AVAILABLE; + } Class CWI_class = [bundle classNamed:@"CWInterface"]; - if (!CWI_class) + if (!CWI_class) { + [pool release]; return NS_ERROR_NOT_AVAILABLE; + } - NSDictionary *params = nil; - NSError *err = nil; - id scanResult = [[CWI_class interface] scanForNetworksWithParameters: params error: err]; - - if (!scanResult) + id scanResult = [[CWI_class interface] scanForNetworksWithParameters:nil error:nil]; + if (!scanResult) { + [pool release]; return NS_ERROR_NOT_AVAILABLE; + } NSArray* scan = [NSMutableArray arrayWithArray:scanResult]; NSEnumerator *enumerator = [scan objectEnumerator]; while (id anObject = [enumerator nextObject]) { nsWifiAccessPoint* ap = new nsWifiAccessPoint(); - if (!ap) + if (!ap) { + [pool release]; return NS_ERROR_OUT_OF_MEMORY; + } NSData* data = [anObject bssidData]; ap->setMac((unsigned char*)[data bytes]); ap->setSignal([[anObject rssi] intValue]); @@ -98,7 +106,13 @@ GetAccessPointsFromWLAN(nsCOMArray &accessPoints) } } @catch(NSException *_exn) { + [pool release]; return NS_ERROR_NOT_AVAILABLE; } + + [pool release]; + return NS_OK; + + NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NS_ERROR_NOT_AVAILABLE); }