diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm index c9ab839ea509..f52a3df4f4ca 100644 --- a/widget/cocoa/nsCocoaFeatures.mm +++ b/widget/cocoa/nsCocoaFeatures.mm @@ -12,6 +12,7 @@ // This API will not work for OS X 10.10, see Gestalt.h. #include "nsCocoaFeatures.h" +#include "nsCocoaUtils.h" #include "nsDebug.h" #include "nsObjCExceptions.h" @@ -51,6 +52,10 @@ nsCocoaFeatures::InitializeVersionNumbers() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + // Provide an autorelease pool to avoid leaking Cocoa objects, + // as this gets called before the main autorelease pool is in place. + nsAutoreleasePool localPool; + int major, minor, bugfix; GetSystemVersion(major, minor, bugfix);