Ignore:
Timestamp:
Jun 18, 2012, 8:32:30 PM (13 years ago)
Author:
[email protected]
Message:

[JSC] In JSGlobalData.cpp, enableAssembler() sometimes leaks two CF objects
https://bugs.webkit.org/show_bug.cgi?id=89415

Reviewed by Sam Weinig.

In the case where canUseJIT was a non-NULL CFBooleanRef,
enableAssembler() would leak both canUseJITKey and canUseJIT by
returning before calling CFRelease. Fix this by using RetainPtr.

  • runtime/JSGlobalData.cpp:

(JSC::enableAssembler):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r119844 r120663  
    5555#include "StrictEvalActivation.h"
    5656#include "StrongInlines.h"
     57#include <wtf/RetainPtr.h>
    5758#include <wtf/Threading.h>
    5859#include <wtf/WTFThreadData.h>
     
    101102
    102103#if USE(CF)
    103     CFStringRef canUseJITKey = CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman);
    104     CFBooleanRef canUseJIT = (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication);
    105     if (canUseJIT) {
     104    RetainPtr<CFStringRef> canUseJITKey(AdoptCF, CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman));
     105    RetainPtr<CFBooleanRef> canUseJIT(AdoptCF, (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey.get(), kCFPreferencesCurrentApplication));
     106    if (canUseJIT)
    106107        return kCFBooleanTrue == canUseJIT;
    107         CFRelease(canUseJIT);
    108     }
    109     CFRelease(canUseJITKey);
    110108#endif
    111109
Note: See TracChangeset for help on using the changeset viewer.