From fc7437abb0042cd2828313c64a4b05d621f31c3d Mon Sep 17 00:00:00 2001 From: Dulma Churchill Date: Thu, 25 Jun 2020 01:47:11 -0700 Subject: [PATCH] [biabduction] Delete Core Foundation models for Memory Leaks Summary: These models for Memory Leaks have been ported to Pulse, so we can remove the models in biabduction and corresponding tests. Reviewed By: skcho Differential Revision: D22206287 fbshipit-source-id: e17499ad3 --- infer/models/objc/src/CoreFoundation.c | 28 -- infer/models/objc/src/CoreGraph.c | 70 ---- infer/models/objc/src/CoreVideo.c | 12 - infer/src/biabduction/Objc_models.ml | 197 ----------- infer/src/biabduction/Objc_models.mli | 13 - infer/src/biabduction/SymExec.ml | 33 +- .../codetoanalyze/objc/biabduction/Makefile | 2 - .../codetoanalyze/objc/biabduction/issues.exp | 9 - .../objc/frontend/noarc/Makefile | 2 - .../objc/pulse/MemoryLeaksInBlocks.m | 29 ++ .../tests/codetoanalyze/objc/pulse/issues.exp | 2 + .../MemoryLeakExample.h | 16 - .../MemoryLeakExample.m | 111 ------ .../MemoryLeakExample.m.dot | 333 ------------------ .../TollBridgeExample.m | 47 --- .../TollBridgeExample.m.dot | 100 ------ 16 files changed, 36 insertions(+), 968 deletions(-) delete mode 100644 infer/models/objc/src/CoreFoundation.c delete mode 100644 infer/models/objc/src/CoreGraph.c delete mode 100644 infer/models/objc/src/CoreVideo.c delete mode 100644 infer/src/biabduction/Objc_models.ml delete mode 100644 infer/src/biabduction/Objc_models.mli create mode 100644 infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m delete mode 100644 infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.h delete mode 100644 infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m delete mode 100644 infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot delete mode 100644 infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m delete mode 100644 infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot diff --git a/infer/models/objc/src/CoreFoundation.c b/infer/models/objc/src/CoreFoundation.c deleted file mode 100644 index 5214f13ee..000000000 --- a/infer/models/objc/src/CoreFoundation.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#import - -void __free_cf(CFTypeRef item); - -void CFRelease(CFTypeRef item) { __free_cf(item); } - -CFRunLoopObserverRef getAngelicObject(); - -CFRunLoopObserverRef CFRunLoopObserverCreateWithHandler( - CFAllocatorRef allocator, - CFOptionFlags activities, - Boolean repeats, - CFIndex order, - void (^block)(CFRunLoopObserverRef observer, CFRunLoopActivity activity)) { - // We need to skip allocation for this function since we currently don't - // handle object finalizers in objc. This is to avoid false positive memory - // leaks when the 'observer' is correctly freed in the block argument. - - // undefined function will get skipped and thus make - // CFRunLoopObserverCreateWithHandler return an angelic object - return getAngelicObject(); -} diff --git a/infer/models/objc/src/CoreGraph.c b/infer/models/objc/src/CoreGraph.c deleted file mode 100644 index 274f3e793..000000000 --- a/infer/models/objc/src/CoreGraph.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -void __free_cf(void* item); - -void* CFAutorelease(void* item) { __free_cf(item); } - -void* CFBridgingRelease(void* item) { __free_cf(item); } - -void CGAffineTransformRelease(void* item) { __free_cf(item); } - -void CGBaseRelease(void* item) { __free_cf(item); } - -void CGBitmapContextRelease(void* item) { __free_cf(item); } - -void CGColorRelease(void* item) { __free_cf(item); } - -void CGColorSpaceRelease(void* item) { __free_cf(item); } - -void CGContextRelease(void* item) { __free_cf(item); } - -void CGDataConsumerRelease(void* item) { __free_cf(item); } - -void CGDataProviderRelease(void* item) { __free_cf(item); } - -void CGErrorRelease(void* item) { __free_cf(item); } - -void CGFontRelease(void* item) { __free_cf(item); } - -void CGFunctionRelease(void* item) { __free_cf(item); } - -void CGGeometryRelease(void* item) { __free_cf(item); } - -void CGGradientRelease(void* item) { __free_cf(item); } - -void CGImageRelease(void* item) { __free_cf(item); } - -void CGLayerRelease(void* item) { __free_cf(item); } - -void CGPathRelease(void* item) { __free_cf(item); } - -void CGPatternRelease(void* item) { __free_cf(item); } - -void CGPDFArrayRelease(void* item) { __free_cf(item); } - -void CGPDFContentStreamRelease(void* item) { __free_cf(item); } - -void CGPDFContextRelease(void* item) { __free_cf(item); } - -void CGPDFDictionaryRelease(void* item) { __free_cf(item); } - -void CGPDFDocumentRelease(void* item) { __free_cf(item); } - -void CGPDFObjectRelease(void* item) { __free_cf(item); } - -void CGPDFOperatorTableRelease(void* item) { __free_cf(item); } - -void CGPDFPageRelease(void* item) { __free_cf(item); } - -void CGPDFScannerRelease(void* item) { __free_cf(item); } - -void CGPDFStreamRelease(void* item) { __free_cf(item); } - -void CGPDFStringRelease(void* item) { __free_cf(item); } - -void CGShadingRelease(void* item) { __free_cf(item); } diff --git a/infer/models/objc/src/CoreVideo.c b/infer/models/objc/src/CoreVideo.c deleted file mode 100644 index 1fb7a083a..000000000 --- a/infer/models/objc/src/CoreVideo.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -#import -#import - -void __free_cf(CVPixelBufferRef item); - -void CVPixelBufferRelease(CVPixelBufferRef pxbuffer) { __free_cf(pxbuffer); } diff --git a/infer/src/biabduction/Objc_models.ml b/infer/src/biabduction/Objc_models.ml deleted file mode 100644 index 5e8d74789..000000000 --- a/infer/src/biabduction/Objc_models.ml +++ /dev/null @@ -1,197 +0,0 @@ -(* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -open! IStd - -(** This module handles C or Objective-C types for which there are special rules for memory - management *) - -(** This module models special c struct types from the Apple's Core Foundation libraries for which - there are particular rules for memory management. *) - -module Core_foundation_model = struct - let core_foundation = - [ "__CFArray" - ; "__CFAttributedString" - ; "__CFBag" - ; "__CFNull" - ; "__CFAllocator" - ; "__CFBinaryHeap" - ; "__CFBitVector" - ; "__CFBundle" - ; "__CFCalendar" - ; "__CFCharacterSet" - ; "__CFDate" - ; "__CFDateFormatter" - ; "__CFDictionary" - ; "__CFError" - ; "__CFFileDescriptor" - ; "__CFFileSecurity" - ; "__CFLocale" - ; "__CFMachPort" - ; "__CFMessagePort" - ; "__CFNotificationCenter" - ; "__CFBoolean" - ; "__CFNumber" - ; "__CFNumberFormatter" - ; "__CFPlugInInstance" - ; "__CFReadStream" - ; "__CFWriteStream" - ; "__CFRunLoop" - ; "__CFRunLoopSource" - ; "__CFRunLoopObserver" - ; "__CFRunLoopTimer" - ; "__CFSet" - ; "__CFStringTokenizer" - ; "__CFSocket" - ; "__CFReadStream" - ; "__CFWriteStream" - ; "__CFTimeZone" - ; "__CFTree" - ; "__CFURLEnumerator" - ; "__CFUUID" ] - - - let cf_network = - [ "_CFHTTPAuthentication" - ; "__CFHTTPMessage" - ; "__CFHost" - ; "__CFNetDiagnostic" - ; "__CFNetService" - ; "__CFNetServiceMonitor" - ; "__CFNetServiceBrowser" ] - - - let core_media = - [ "OpaqueCMBlockBuffer" - ; "opaqueCMBufferQueue" - ; "opaqueCMBufferQueueTriggerToken" - ; "opaqueCMFormatDescription" - ; "OpaqueCMMemoryPool" - ; "opaqueCMSampleBuffer" - ; "opaqueCMSimpleQueue" - ; "OpaqueCMClock" - ; "OpaqueCMTimebase" ] - - - let core_text = - [ "__CTFont" - ; "__CTFontCollection" - ; "__CTFontDescriptor" - ; "__CTFrame" - ; "__CTFramesetter" - ; "__CTGlyphInfo" - ; "__CTLine" - ; "__CTParagraphStyle" - ; "__CTRubyAnnotation" - ; "__CTRun" - ; "__CTRunDelegate" - ; "__CTTextTab" - ; "__CTTypesetter" ] - - - let core_video = - ["__CVBuffer"; "__CVMetalTextureCache"; "__CVOpenGLESTextureCache"; "__CVPixelBufferPool"] - - - let image_io = ["CGImageDestination"; "CGImageMetadata"; "CGImageMetadataTag"; "CGImageSource"] - - let security = - [ "__SecCertificate" - ; "__SecIdentity" - ; "__SecKey" - ; "__SecPolicy" - ; "__SecAccessControl" - ; "__SecRandom" - ; "__SecCode" - ; "__SecTrust" - ; "__SecRequirement" ] - - - let system_configuration = - [ "__SCDynamicStore" - ; "__SCNetworkInterface" - ; "__SCBondStatus" - ; "__SCNetworkProtocol" - ; "__SCNetworkService" - ; "__SCNetworkSet" - ; "__SCNetworkConnection" - ; "__SCNetworkReachability" - ; "__SCPreferences" ] - - - let core_graphics_types = - [ "CGAffineTransform" - ; "CGBase" - ; "CGBitmapContext" - ; "CGColor" - ; "CGColorSpace" - ; "CGContext" - ; "CGDataConsumer" - ; "CGDataProvider" - ; "CGError" - ; "CGFont" - ; "CGFunction" - ; "CGGeometry" - ; "CGGradient" - ; "CGImage" - ; "CGLayer" - ; "CGPath" - ; "CGPattern" - ; "CGPDFArray" - ; "CGPDFContentStream" - ; "CGPDFContext" - ; "CGPDFDictionary" - ; "CGPDFDocument" - ; "CGPDFObject" - ; "CGPDFOperatorTable" - ; "CGPDFPage" - ; "CGPDFScanner" - ; "CGPDFStream" - ; "CGPDFString" - ; "CGShading" ] - - - let core_foundation_types = - core_foundation @ cf_network @ core_media @ core_text @ core_video @ image_io @ security - @ system_configuration - - - let copy = "Copy" - - let create = "Create" - - type core_lib = Core_foundation | Core_graphics - - let core_lib_to_type_list lib = - match lib with Core_foundation -> core_foundation_types | Core_graphics -> core_graphics_types - - - let rec is_core_lib lib typ = - match typ.Typ.desc with - | Typ.Tptr (styp, _) -> - is_core_lib lib styp - | Typ.Tstruct name -> - let core_lib_types = core_lib_to_type_list lib in - List.mem ~equal:String.equal core_lib_types (Typ.Name.name name) - | _ -> - false - - - let is_core_foundation_type typ = is_core_lib Core_foundation typ - - let is_core_graphics_type typ = is_core_lib Core_graphics typ - - let is_core_lib_type typ = is_core_foundation_type typ || is_core_graphics_type typ - - let is_core_lib_create typ funct = - is_core_lib_type typ - && (String.is_substring ~substring:create funct || String.is_substring ~substring:copy funct) -end - -let is_malloc_model return_type pname = - Core_foundation_model.is_core_lib_create return_type (Procname.to_string pname) diff --git a/infer/src/biabduction/Objc_models.mli b/infer/src/biabduction/Objc_models.mli deleted file mode 100644 index f2c663b15..000000000 --- a/infer/src/biabduction/Objc_models.mli +++ /dev/null @@ -1,13 +0,0 @@ -(* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - *) - -open! IStd - -(** This module models special c struct types from the Apple's Core Foundation libraries for which - there are particular rules for memory management. *) - -val is_malloc_model : Typ.t -> Procname.t -> bool diff --git a/infer/src/biabduction/SymExec.ml b/infer/src/biabduction/SymExec.ml index 607d71ac7..2442b6e28 100644 --- a/infer/src/biabduction/SymExec.ml +++ b/infer/src/biabduction/SymExec.ml @@ -1267,20 +1267,12 @@ let rec sym_exec | Some resolved_pdesc -> let attrs = Procdesc.get_attributes resolved_pdesc in let ret_type = attrs.ProcAttributes.ret_type in - let model_as_malloc ret_type resolved_pname = - Objc_models.is_malloc_model ret_type resolved_pname + let is_objc_instance_method = + ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind + ClangMethodKind.OBJC_INSTANCE in - if model_as_malloc ret_type resolved_pname then - (* If it's an alloc model, call alloc rather than skipping *) - sym_exec_alloc_model analysis_data resolved_pname ret_type ret_id_typ loc - prop path - else - let is_objc_instance_method = - ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind - ClangMethodKind.OBJC_INSTANCE - in - skip_call ~is_objc_instance_method ~reason prop path resolved_pname - ret_annots loc ret_id_typ ret_type n_actual_params + skip_call ~is_objc_instance_method ~reason prop path resolved_pname + ret_annots loc ret_id_typ ret_type n_actual_params | None -> skip_call ~reason prop path resolved_pname ret_annots loc ret_id_typ (snd ret_id_typ) n_actual_params ) @@ -1605,21 +1597,6 @@ and check_variadic_sentinel_if_present ({Builtin.prop_; path; proc_name} as buil [(prop_, path)] -and sym_exec_alloc_model analysis_data pname ret_typ ret_id_typ loc prop path : Builtin.ret_typ = - let alloc_source_function_arg = (Exp.Const (Const.Cfun pname), Typ.void) in - let args = - let sizeof_exp = - Exp.Sizeof {typ= ret_typ; nbytes= None; dynamic_length= None; subtype= Subtype.exact} - in - let exp = (sizeof_exp, Typ.mk (Tint Typ.IULong)) in - [exp; alloc_source_function_arg] - in - let alloc_fun = Exp.Const (Const.Cfun BuiltinDecl.malloc_no_fail) in - let alloc_instr = Sil.Call (ret_id_typ, alloc_fun, args, loc, CallFlags.default) in - L.d_strln "No spec found, method should be model as alloc, executing alloc... " ; - instrs analysis_data (Instrs.singleton alloc_instr) [(prop, path)] - - (** Perform symbolic execution for a function call *) and proc_call (callee_pdesc, callee_summary) { Builtin.analysis_data= {tenv; proc_desc= caller_pdesc; _} as analysis_data diff --git a/infer/tests/codetoanalyze/objc/biabduction/Makefile b/infer/tests/codetoanalyze/objc/biabduction/Makefile index c2c46684e..c3a29601a 100644 --- a/infer/tests/codetoanalyze/objc/biabduction/Makefile +++ b/infer/tests/codetoanalyze/objc/biabduction/Makefile @@ -40,7 +40,6 @@ SOURCES_DEFAULT = \ shared/category_procdesc/EOCPerson.m \ shared/memory_leaks_benchmark/ArcExample.m \ shared/memory_leaks_benchmark/AutoreleaseExample.m \ - shared/memory_leaks_benchmark/MemoryLeakExample.m \ shared/memory_leaks_benchmark/RetainReleaseExample.m \ shared/memory_leaks_benchmark/arc_methods.m \ shared/npe/Available_expr.m \ @@ -105,7 +104,6 @@ SOURCES_ARC = \ npe/nullable.m \ property/ExplicitIvarName.m \ shared/block/dispatch_examples.m \ - shared/memory_leaks_benchmark/TollBridgeExample.m \ subtyping/KindOfClassExample.m \ variadic_methods/premature_nil_termination.m \ diff --git a/infer/tests/codetoanalyze/objc/biabduction/issues.exp b/infer/tests/codetoanalyze/objc/biabduction/issues.exp index c0b450292..84396119c 100644 --- a/infer/tests/codetoanalyze/objc/biabduction/issues.exp +++ b/infer/tests/codetoanalyze/objc/biabduction/issues.exp @@ -84,8 +84,6 @@ codetoanalyze/objc/biabduction/subtyping/KindOfClassExample.m, shouldThrowDivide codetoanalyze/objc/biabduction/subtyping/KindOfClassExample.m, shouldThrowDivideByZero2, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure shouldThrowDivideByZero2(),start of procedure init,return from a call to Base.init,start of procedure returnsZero2(),Taking false branch,return from a call to returnsZero2] codetoanalyze/objc/biabduction/subtyping/KindOfClassExample.m, shouldThrowDivideByZero3, 3, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure shouldThrowDivideByZero3(),start of procedure init,return from a call to Derived.init,Taking true branch] codetoanalyze/objc/biabduction/variadic_methods/premature_nil_termination.m, PrematureNilTermA.nilInArrayWithObjects, 5, PREMATURE_NIL_TERMINATION_ARGUMENT, B1, WARNING, [start of procedure nilInArrayWithObjects] -codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m, TollBridgeExample.bridge, 2, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure bridge] -codetoanalyze/objc/biabduction/memory_leaks_benchmark/CoreVideoExample.m, CoreVideoExample.cvpixelbuffer_not_released_leak, 1, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure cvpixelbuffer_not_released_leak] codetoanalyze/objc/biabduction/memory_leaks_benchmark/NSData_models_tests.m, NSData_models_tests.macForIV:, 2, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure macForIV:] codetoanalyze/objc/biabduction/memory_leaks_benchmark/NSString_models_tests.m, StringInitA.hexStringValue, 11, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure hexStringValue,Skipping CFStringCreateWithBytesNoCopy(): method has no implementation,Taking false branch] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleLength3.m, strongcycle, 6, BIABDUCTION_ANALYSIS_STOPS, no_bucket, WARNING, [start of procedure strongcycle(),start of procedure setB:,return from a call to AA.setB:,start of procedure setC:,return from a call to BB.setC:,start of procedure setA:,return from a call to CC.setA:] @@ -115,11 +113,4 @@ codetoanalyze/objc/shared/annotations/nullable_annotations.m, User.otherUserName codetoanalyze/objc/shared/annotations/nullable_annotations.m, npe_property_nullable, 3, NULL_DEREFERENCE, B1, ERROR, [start of procedure npe_property_nullable(),Skipping child: method has no implementation] codetoanalyze/objc/shared/annotations/nullable_annotations_fields.m, A.nullable_field, 3, NULL_DEREFERENCE, B1, ERROR, [start of procedure nullable_field,Skipping getA(): method has no implementation] codetoanalyze/objc/shared/block/dispatch.m, DispatchA.dispatch_a_block_variable_from_macro_delivers_initialised_object, 3, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure dispatch_a_block_variable_from_macro_delivers_initialised_object,start of procedure dispatch_a_block_variable_from_macro,return from a call to DispatchA.dispatch_a_block_variable_from_macro] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.blockCapturedVarLeak, 6, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure blockCapturedVarLeak,start of procedure block,return from a call to objc_blockMemoryLeakExample.blockCapturedVarLeak_1] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.createCloseCrossGlyph:, 2, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure createCloseCrossGlyph:,Skipping CGRectGetHeight(): method has no implementation] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.measureFrameSizeForText, 1, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure measureFrameSizeForText] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.regularLeak, 3, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure regularLeak] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.test, 3, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure test,start of procedure backgroundCoveringView,return from a call to MemoryLeakExample.backgroundCoveringView,Skipping bounds: method has no implementation,start of procedure backgroundCoveringView,return from a call to MemoryLeakExample.backgroundCoveringView,Skipping setShadowPath:: method has no implementation] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.test1:, 1, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure test1:] -codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m, MemoryLeakExample.test2:, 1, BIABDUCTION_MEMORY_LEAK, no_bucket, ERROR, [start of procedure test2:] codetoanalyze/objc/shared/npe/Available_expr.m, Available_expr.test_no_bug, 3, NULL_DEREFERENCE, B1, ERROR, [start of procedure test_no_bug,Taking true branch] diff --git a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile index 1aadd5566..564b1acde 100644 --- a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile +++ b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile @@ -40,9 +40,7 @@ SOURCES = \ ../shared/category_procdesc/main.c \ ../shared/field_superclass/SuperExample.m \ ../shared/memory_leaks_benchmark/AutoreleaseExample.m \ - ../shared/memory_leaks_benchmark/MemoryLeakExample.m \ ../shared/memory_leaks_benchmark/RetainReleaseExample.m \ - ../shared/memory_leaks_benchmark/TollBridgeExample.m \ ../shared/npe/npe_malloc.m \ ../shared/property/GetterExample.m \ ../shared/property/PropertyAttributes.m \ diff --git a/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m b/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m new file mode 100644 index 000000000..d16a23930 --- /dev/null +++ b/infer/tests/codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m @@ -0,0 +1,29 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#include + +int block_captured_var_leak_bad() { + int* x = malloc(sizeof(int)); + *x = 2; + int (^blk)(void) = ^() { + return *x; + }; + return blk(); +} + +int block_free_ok_FP() { + int* x = malloc(sizeof(int)); + *x = 2; + int (^blk)(void) = ^() { + int i = *x; + free(x); + return i; + }; + return blk(); +} diff --git a/infer/tests/codetoanalyze/objc/pulse/issues.exp b/infer/tests/codetoanalyze/objc/pulse/issues.exp index df4cfe665..aa7da5dac 100644 --- a/infer/tests/codetoanalyze/objc/pulse/issues.exp +++ b/infer/tests/codetoanalyze/objc/pulse/issues.exp @@ -6,5 +6,7 @@ codetoanalyze/objc/pulse/MemoryLeaks.m, MemoryLeaks.cg_path_create_with_rect_lea codetoanalyze/objc/pulse/MemoryLeaks.m, MemoryLeaks.no_bridge_leak_bad, 1, MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocated by call to `CFLocaleCreate` (modelled),allocation part of the trace ends here,memory becomes unreachable here] codetoanalyze/objc/pulse/MemoryLeaks.m, call_bridge_interproc_leak_ok_FP, 2, MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocated by call to `CFLocaleCreate` (modelled),allocation part of the trace ends here,memory becomes unreachable here] codetoanalyze/objc/pulse/MemoryLeaks.m, call_cfrelease_interproc_leak_ok_FP, 2, MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocated by call to `CFLocaleCreate` (modelled),allocation part of the trace ends here,memory becomes unreachable here] +codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m, block_captured_var_leak_bad, 3, MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocated by call to `malloc_no_fail` (modelled),allocation part of the trace ends here,memory becomes unreachable here] +codetoanalyze/objc/pulse/MemoryLeaksInBlocks.m, block_free_ok_FP, 3, MEMORY_LEAK, no_bucket, ERROR, [allocation part of the trace starts here,allocated by call to `malloc_no_fail` (modelled),allocation part of the trace ends here,memory becomes unreachable here] codetoanalyze/objc/pulse/use_after_free.m, PulseTest.use_after_free_simple_in_objc_method_bad:, 2, USE_AFTER_FREE, no_bucket, ERROR, [invalidation part of the trace starts here,parameter `x` of PulseTest.use_after_free_simple_in_objc_method_bad:,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of PulseTest.use_after_free_simple_in_objc_method_bad:,invalid access occurs here] codetoanalyze/objc/pulse/use_after_free.m, use_after_free_simple_bad, 2, USE_AFTER_FREE, no_bucket, ERROR, [invalidation part of the trace starts here,parameter `x` of use_after_free_simple_bad,was invalidated by call to `free()`,use-after-lifetime part of the trace starts here,parameter `x` of use_after_free_simple_bad,invalid access occurs here] diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.h b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.h deleted file mode 100644 index 0bbcc5f1f..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface MemoryLeakExample : NSObject - -@property(strong) UIView* backgroundCoveringView; -@property(strong) UIView* attachmentContainerView; - -@end diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m deleted file mode 100644 index a7d15fde2..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "MemoryLeakExample.h" -#import -#import -#import - -@implementation MemoryLeakExample - -// For now it doesn't contain memory leak by default. Later, if we remove -// CFRelease, there should be a leak. -- (void)layoutSubviews { - UIView* attachmentContainerView = [UIView alloc]; - CGPathRef shadowPath = - CGPathCreateWithRect(attachmentContainerView.bounds, NULL); - // self.attachmentContainerView.layer.shadowPath = shadowPath; - CGPathRelease(shadowPath); - [attachmentContainerView release]; -} - -- (void)test { - CGPathRef shadowPath = - CGPathCreateWithRect(self.backgroundCoveringView.bounds, NULL); - self.backgroundCoveringView.layer.shadowPath = shadowPath; -} - -+ (void)measureFrameSizeForText { - CFAttributedStringCreateMutable(nil, 0); -} - -+ (void)measureFrameSizeForTextNoLeak { - CFMutableAttributedStringRef maString = - CFAttributedStringCreateMutable(nil, 0); - CFRelease(maString); -} - -+ (void)test1:(CFAttributedStringRef)str { - CTFramesetterCreateWithAttributedString(str); -} - -+ (void)test1NoLeak { - CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(nil); - CFRelease(framesetter); -} - -+ (void)createCloseCrossGlyph:(CGRect)rect { - 0.20f * CGRectGetHeight(rect); - CGPathCreateMutable(); -} - -+ (void)createCloseCrossGlyphNoLeak:(CGRect)rect { - CGFloat lineThickness = 0.20f * CGRectGetHeight(rect); - - // One rectangle - CGMutablePathRef path1 = CGPathCreateMutable(); - CFRelease(path1); -} - -+ (void)test2:(SecTrustRef)trust { - SecTrustCopyPublicKey(trust); -} - -+ (void)test2NoLeak { - SecKeyRef allowedPublicKey = SecTrustCopyPublicKey(nil); - CFRelease(allowedPublicKey); -} - -+ (void)testImageRefRelease { - CGImageRef newImage = CGBitmapContextCreateImage(nil); - CGImageRelease(newImage); -} - -CGColorRef FBColorCreateWithGray(CGFloat gray, CGFloat a); - -- (id)testFBColorCreateWithGray { - CGColorRef borderColor = FBColorCreateWithGray(0.0, 0.3); - CGColorRelease(borderColor); -} - -- (int)regularLeak { - int* x = malloc(sizeof(int)); - *x = 7; - return *x; -} - -- (int)blockCapturedVarLeak { - int* x = malloc(sizeof(int)); - *x = 2; - int (^blk)(void) = ^() { - return *x; - }; - return blk(); -} - -- (int)blockFreeNoLeak { - int* x = malloc(sizeof(int)); - *x = 2; - int (^blk)(void) = ^() { - int i = *x; - free(x); - return i; - }; - return blk(); -} - -@end diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot deleted file mode 100644 index b6d887f66..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/MemoryLeakExample.m.dot +++ /dev/null @@ -1,333 +0,0 @@ -/* @generated */ -digraph cfg { -"objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_1" [label="1: Start objc_blockMemoryLeakExample.blockCapturedVarLeak_1\nFormals: x:int*\nLocals: \nCaptured: x:int* \n " color=yellow style=filled] - - - "objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_1" -> "objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_3" ; -"objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_2" [label="2: Exit objc_blockMemoryLeakExample.blockCapturedVarLeak_1 \n " color=yellow style=filled] - - -"objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_3" [label="3: Return Stmt \n n$52=*&x:int* [line 95, column 13]\n n$53=*n$52:int [line 95, column 12]\n *&return:int=n$53 [line 95, column 5]\n " shape="box"] - - - "objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_3" -> "objc_blockMemoryLeakExample.blockCapturedVarLeak_1.74cf15f2799999b1100e5a876dbb3ac4_2" ; -"objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_1" [label="1: Start objc_blockMemoryLeakExample.blockFreeNoLeak_2\nFormals: x:int*\nLocals: i:int\nCaptured: x:int* \n " color=yellow style=filled] - - - "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_1" -> "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_5" ; -"objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_2" [label="2: Exit objc_blockMemoryLeakExample.blockFreeNoLeak_2 \n " color=yellow style=filled] - - -"objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_3" [label="3: Return Stmt \n n$59=*&i:int [line 106, column 12]\n *&return:int=n$59 [line 106, column 5]\n " shape="box"] - - - "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_3" -> "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_2" ; -"objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_4" [label="4: Call _fun_free \n n$60=*&x:int* [line 105, column 10]\n n$61=_fun_free(n$60:void*) [line 105, column 5]\n " shape="box"] - - - "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_4" -> "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_3" ; -"objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_5" [label="5: DeclStmt \n VARIABLE_DECLARED(i:int); [line 104, column 5]\n n$62=*&x:int* [line 104, column 14]\n n$63=*n$62:int [line 104, column 13]\n *&i:int=n$63 [line 104, column 5]\n " shape="box"] - - - "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_5" -> "objc_blockMemoryLeakExample.blockFreeNoLeak_2.c788da2c768efd587ffe2f3483f8b01b_4" ; -"createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_1" [label="1: Start MemoryLeakExample.createCloseCrossGlyph:\nFormals: rect:CGRect\nLocals: \n " color=yellow style=filled] - - - "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_1" -> "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_4" ; -"createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_2" [label="2: Exit MemoryLeakExample.createCloseCrossGlyph: \n " color=yellow style=filled] - - -"createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_3" [label="3: Call _fun_CGPathCreateMutable \n n$26=_fun_CGPathCreateMutable() [line 53, column 3]\n " shape="box"] - - - "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_3" -> "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_2" ; -"createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_4" [label="4: BinaryOperatorStmt: Mul \n n$27=*&rect:CGRect [line 52, column 27]\n n$28=_fun_CGRectGetHeight(n$27:CGRect) [line 52, column 11]\n " shape="box"] - - - "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_4" -> "createCloseCrossGlyph:#MemoryLeakExample#class.b78475cbe035b221b50538a8aad3c9cf_3" ; -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_1" [label="1: Start MemoryLeakExample.createCloseCrossGlyphNoLeak:\nFormals: rect:CGRect\nLocals: path1:CGPath* lineThickness:double \n " color=yellow style=filled] - - - "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_1" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" ; -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_2" [label="2: Exit MemoryLeakExample.createCloseCrossGlyphNoLeak: \n " color=yellow style=filled] - - -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_3" [label="3: Call _fun_CFRelease \n n$29=*&path1:CGPath* [line 61, column 13]\n n$30=_fun_CFRelease(n$29:void const *) [line 61, column 3]\n " shape="box"] - - - "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_3" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_2" ; -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_4" [label="4: DeclStmt \n VARIABLE_DECLARED(path1:CGPath*); [line 60, column 3]\n n$31=_fun_CGPathCreateMutable() [line 60, column 28]\n *&path1:CGPath*=n$31 [line 60, column 3]\n " shape="box"] - - - "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_4" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_3" ; -"createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" [label="5: DeclStmt \n VARIABLE_DECLARED(lineThickness:double); [line 57, column 3]\n n$32=*&rect:CGRect [line 57, column 51]\n n$33=_fun_CGRectGetHeight(n$32:CGRect) [line 57, column 35]\n *&lineThickness:double=(0.200000003 * n$33) [line 57, column 3]\n " shape="box"] - - - "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_5" -> "createCloseCrossGlyphNoLeak:#MemoryLeakExample#class.0954bcd442044fd9788af38303a3790b_4" ; -"measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_1" [label="1: Start MemoryLeakExample.measureFrameSizeForText\nFormals: \nLocals: \n " color=yellow style=filled] - - - "measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_1" -> "measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_3" ; -"measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_2" [label="2: Exit MemoryLeakExample.measureFrameSizeForText \n " color=yellow style=filled] - - -"measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_3" [label="3: Call _fun_CFAttributedStringCreateMutable \n n$17=_fun_CFAttributedStringCreateMutable(null:__CFAllocator const *,0:long) [line 33, column 3]\n " shape="box"] - - - "measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_3" -> "measureFrameSizeForText#MemoryLeakExample#class.f59bd9e59cef3fd16475487a380b3804_2" ; -"measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_1" [label="1: Start MemoryLeakExample.measureFrameSizeForTextNoLeak\nFormals: \nLocals: maString:__CFAttributedString* \n " color=yellow style=filled] - - - "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_1" -> "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_4" ; -"measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_2" [label="2: Exit MemoryLeakExample.measureFrameSizeForTextNoLeak \n " color=yellow style=filled] - - -"measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_3" [label="3: Call _fun_CFRelease \n n$18=*&maString:__CFAttributedString* [line 39, column 13]\n n$19=_fun_CFRelease(n$18:void const *) [line 39, column 3]\n " shape="box"] - - - "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_3" -> "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_2" ; -"measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_4" [label="4: DeclStmt \n VARIABLE_DECLARED(maString:__CFAttributedString*); [line 37, column 3]\n n$20=_fun_CFAttributedStringCreateMutable(null:__CFAllocator const *,0:long) [line 38, column 7]\n *&maString:__CFAttributedString*=n$20 [line 37, column 3]\n " shape="box"] - - - "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_4" -> "measureFrameSizeForTextNoLeak#MemoryLeakExample#class.9443bec011166230e1709abbe3c930d4_3" ; -"test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_1" [label="1: Start MemoryLeakExample.test1:\nFormals: str:__CFAttributedString const *\nLocals: \n " color=yellow style=filled] - - - "test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_1" -> "test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_3" ; -"test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_2" [label="2: Exit MemoryLeakExample.test1: \n " color=yellow style=filled] - - -"test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_3" [label="3: Call _fun_CTFramesetterCreateWithAttributedString \n n$21=*&str:__CFAttributedString const * [line 43, column 43]\n n$22=_fun_CTFramesetterCreateWithAttributedString(n$21:__CFAttributedString const *) [line 43, column 3]\n " shape="box"] - - - "test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_3" -> "test1:#MemoryLeakExample(struct __CFAttributedString)#class.5c69af4eb9da1845df6efe64785fd0c9_2" ; -"test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_1" [label="1: Start MemoryLeakExample.test1NoLeak\nFormals: \nLocals: framesetter:__CTFramesetter const * \n " color=yellow style=filled] - - - "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_1" -> "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_4" ; -"test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_2" [label="2: Exit MemoryLeakExample.test1NoLeak \n " color=yellow style=filled] - - -"test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_3" [label="3: Call _fun_CFRelease \n n$23=*&framesetter:__CTFramesetter const * [line 48, column 13]\n n$24=_fun_CFRelease(n$23:void const *) [line 48, column 3]\n " shape="box"] - - - "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_3" -> "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_2" ; -"test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_4" [label="4: DeclStmt \n VARIABLE_DECLARED(framesetter:__CTFramesetter const *); [line 47, column 3]\n n$25=_fun_CTFramesetterCreateWithAttributedString(null:__CFAttributedString const *) [line 47, column 34]\n *&framesetter:__CTFramesetter const *=n$25 [line 47, column 3]\n " shape="box"] - - - "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_4" -> "test1NoLeak#MemoryLeakExample#class.7e0d9640dbd86a21622e801793707bd9_3" ; -"test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_1" [label="1: Start MemoryLeakExample.test2:\nFormals: trust:__SecTrust*\nLocals: \n " color=yellow style=filled] - - - "test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_1" -> "test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_3" ; -"test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_2" [label="2: Exit MemoryLeakExample.test2: \n " color=yellow style=filled] - - -"test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_3" [label="3: Call _fun_SecTrustCopyPublicKey \n n$34=*&trust:__SecTrust* [line 65, column 25]\n n$35=_fun_SecTrustCopyPublicKey(n$34:__SecTrust*) [line 65, column 3]\n " shape="box"] - - - "test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_3" -> "test2:#MemoryLeakExample(struct __SecTrust)#class.0351c8bd25e5a49860146e05fbc5b49a_2" ; -"test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_1" [label="1: Start MemoryLeakExample.test2NoLeak\nFormals: \nLocals: allowedPublicKey:__SecKey* \n " color=yellow style=filled] - - - "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_1" -> "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_4" ; -"test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_2" [label="2: Exit MemoryLeakExample.test2NoLeak \n " color=yellow style=filled] - - -"test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_3" [label="3: Call _fun_CFRelease \n n$36=*&allowedPublicKey:__SecKey* [line 70, column 13]\n n$37=_fun_CFRelease(n$36:void const *) [line 70, column 3]\n " shape="box"] - - - "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_3" -> "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_2" ; -"test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_4" [label="4: DeclStmt \n VARIABLE_DECLARED(allowedPublicKey:__SecKey*); [line 69, column 3]\n n$38=_fun_SecTrustCopyPublicKey(null:__SecTrust*) [line 69, column 32]\n *&allowedPublicKey:__SecKey*=n$38 [line 69, column 3]\n " shape="box"] - - - "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_4" -> "test2NoLeak#MemoryLeakExample#class.69cf0c35f7df26deefa723cac655894d_3" ; -"testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_1" [label="1: Start MemoryLeakExample.testImageRefRelease\nFormals: \nLocals: newImage:CGImage* \n " color=yellow style=filled] - - - "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_1" -> "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_4" ; -"testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_2" [label="2: Exit MemoryLeakExample.testImageRefRelease \n " color=yellow style=filled] - - -"testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_3" [label="3: Call _fun_CGImageRelease \n n$39=*&newImage:CGImage* [line 75, column 18]\n n$40=_fun_CGImageRelease(n$39:CGImage*) [line 75, column 3]\n " shape="box"] - - - "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_3" -> "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_2" ; -"testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_4" [label="4: DeclStmt \n VARIABLE_DECLARED(newImage:CGImage*); [line 74, column 3]\n n$41=_fun_CGBitmapContextCreateImage(null:CGContext*) [line 74, column 25]\n *&newImage:CGImage*=n$41 [line 74, column 3]\n " shape="box"] - - - "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_4" -> "testImageRefRelease#MemoryLeakExample#class.fa3cf5eac6a14b14c5050c7d62d2a79f_3" ; -"attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_1" [label="1: Start MemoryLeakExample.attachmentContainerView\nFormals: self:MemoryLeakExample*\nLocals: \n " color=yellow style=filled] - - - "attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_1" -> "attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_3" ; -"attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_2" [label="2: Exit MemoryLeakExample.attachmentContainerView \n " color=yellow style=filled] - - -"attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_3" [label="3: BinaryOperatorStmt: Node \n n$10=*&self:MemoryLeakExample* [line 14, column 27]\n n$11=*n$10._attachmentContainerView:UIView* [line 14, column 27]\n *&return:UIView*=n$11 [line 14, column 27]\n " shape="box"] - - - "attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_3" -> "attachmentContainerView#MemoryLeakExample#instance.aff4fd13563e9783b77bb7f4c56c06f7_2" ; -"backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_1" [label="1: Start MemoryLeakExample.backgroundCoveringView\nFormals: self:MemoryLeakExample*\nLocals: \n " color=yellow style=filled] - - - "backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_1" -> "backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_3" ; -"backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_2" [label="2: Exit MemoryLeakExample.backgroundCoveringView \n " color=yellow style=filled] - - -"backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_3" [label="3: BinaryOperatorStmt: Node \n n$6=*&self:MemoryLeakExample* [line 13, column 27]\n n$7=*n$6._backgroundCoveringView:UIView* [line 13, column 27]\n *&return:UIView*=n$7 [line 13, column 27]\n " shape="box"] - - - "backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_3" -> "backgroundCoveringView#MemoryLeakExample#instance.274e2fe96127ee4833b32c350286035f_2" ; -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_1" [label="1: Start MemoryLeakExample.blockCapturedVarLeak\nFormals: self:MemoryLeakExample*\nLocals: blk:_fn_(*) x:int* \n " color=yellow style=filled] - - - "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_1" -> "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_6" ; -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_2" [label="2: Exit MemoryLeakExample.blockCapturedVarLeak \n " color=yellow style=filled] - - -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_3" [label="3: Return Stmt \n n$49=*&blk:_fn_(*) [line 97, column 10]\n n$50=n$49() objc_block [line 97, column 10]\n *&return:int=n$50 [line 97, column 3]\n " shape="box"] - - - "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_3" -> "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_2" ; -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_4" [label="4: DeclStmt \n VARIABLE_DECLARED(blk:_fn_(*)); [line 94, column 3]\n n$51=*&x:int* [line 94, column 22]\n *&blk:_fn_(*)=(_fun_objc_blockMemoryLeakExample.blockCapturedVarLeak_1,(n$51 &x:int*)) [line 94, column 3]\n " shape="box"] - - - "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_4" -> "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_3" ; -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_5" [label="5: BinaryOperatorStmt: Assign \n n$54=*&x:int* [line 93, column 4]\n *n$54:int=2 [line 93, column 3]\n " shape="box"] - - - "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_5" -> "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_4" ; -"blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_6" [label="6: DeclStmt \n VARIABLE_DECLARED(x:int*); [line 92, column 3]\n n$55=_fun_malloc_no_fail(sizeof(t=int;nbytes=4):int) [line 92, column 12]\n *&x:int*=(int*)n$55 [line 92, column 3]\n " shape="box"] - - - "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_6" -> "blockCapturedVarLeak#MemoryLeakExample#instance.53bb018bc84d6a696dc756e20b5b3f52_5" ; -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_1" [label="1: Start MemoryLeakExample.blockFreeNoLeak\nFormals: self:MemoryLeakExample*\nLocals: blk:_fn_(*) x:int* \n " color=yellow style=filled] - - - "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_1" -> "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_6" ; -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_2" [label="2: Exit MemoryLeakExample.blockFreeNoLeak \n " color=yellow style=filled] - - -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_3" [label="3: Return Stmt \n n$56=*&blk:_fn_(*) [line 108, column 10]\n n$57=n$56() objc_block [line 108, column 10]\n *&return:int=n$57 [line 108, column 3]\n " shape="box"] - - - "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_3" -> "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_2" ; -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_4" [label="4: DeclStmt \n VARIABLE_DECLARED(blk:_fn_(*)); [line 103, column 3]\n n$58=*&x:int* [line 103, column 22]\n *&blk:_fn_(*)=(_fun_objc_blockMemoryLeakExample.blockFreeNoLeak_2,(n$58 &x:int*)) [line 103, column 3]\n " shape="box"] - - - "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_4" -> "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_3" ; -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_5" [label="5: BinaryOperatorStmt: Assign \n n$64=*&x:int* [line 102, column 4]\n *n$64:int=2 [line 102, column 3]\n " shape="box"] - - - "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_5" -> "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_4" ; -"blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_6" [label="6: DeclStmt \n VARIABLE_DECLARED(x:int*); [line 101, column 3]\n n$65=_fun_malloc_no_fail(sizeof(t=int;nbytes=4):int) [line 101, column 12]\n *&x:int*=(int*)n$65 [line 101, column 3]\n " shape="box"] - - - "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_6" -> "blockFreeNoLeak#MemoryLeakExample#instance.6bcefe2afb9f172f8aadbab54d9bd144_5" ; -"dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_1" [label="1: Start MemoryLeakExample.dealloc\nFormals: self:MemoryLeakExample*\nLocals: \n " color=yellow style=filled] - - - "dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_1" -> "dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_3" ; -"dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_2" [label="2: Exit MemoryLeakExample.dealloc \n " color=yellow style=filled] - - -"dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_3" [label="3: Call dealloc \n n$0=*&self:MemoryLeakExample* [line 111, column 1]\n n$1=*n$0._attachmentContainerView:UIView* [line 111, column 1]\n n$2=_fun_UIView.dealloc(n$1:UIView*) [line 111, column 1]\n n$3=*&self:MemoryLeakExample* [line 111, column 1]\n n$4=*n$3._backgroundCoveringView:UIView* [line 111, column 1]\n n$5=_fun_UIView.dealloc(n$4:UIView*) [line 111, column 1]\n " shape="box"] - - - "dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_3" -> "dealloc#MemoryLeakExample#instance.f11793396cace30d3e6f98c00cf65308_2" ; -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_1" [label="1: Start MemoryLeakExample.layoutSubviews\nFormals: self:MemoryLeakExample*\nLocals: shadowPath:CGPath const * attachmentContainerView:UIView* \n " color=yellow style=filled] - - - "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_1" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_6" ; -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_2" [label="2: Exit MemoryLeakExample.layoutSubviews \n " color=yellow style=filled] - - -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" [label="3: Message Call: release \n n$0=*&attachmentContainerView:UIView* [line 23, column 4]\n n$1=_fun_NSObject.release(n$0:UIView*) virtual [line 23, column 3]\n " shape="box"] - - - "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_2" ; -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_4" [label="4: Call _fun_CGPathRelease \n n$2=*&shadowPath:CGPath const * [line 22, column 17]\n n$3=_fun_CGPathRelease(n$2:CGPath const *) [line 22, column 3]\n " shape="box"] - - - "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_4" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_3" ; -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_5" [label="5: DeclStmt \n VARIABLE_DECLARED(shadowPath:CGPath const *); [line 19, column 3]\n n$4=*&attachmentContainerView:UIView* [line 20, column 28]\n n$5=_fun_UIView.bounds(n$4:UIView*) [line 20, column 52]\n n$6=_fun_CGPathCreateWithRect(n$5:CGRect,null:CGAffineTransform const *) [line 20, column 7]\n *&shadowPath:CGPath const *=n$6 [line 19, column 3]\n " shape="box"] - - - "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_5" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_4" ; -"layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_6" [label="6: DeclStmt \n VARIABLE_DECLARED(attachmentContainerView:UIView*); [line 18, column 3]\n n$7=_fun___objc_alloc_no_fail(sizeof(t=UIView):unsigned long) [line 18, column 37]\n *&attachmentContainerView:UIView*=n$7 [line 18, column 3]\n " shape="box"] - - - "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_6" -> "layoutSubviews#MemoryLeakExample#instance.2b3151f18431bcdbc08267ea4ff96f53_5" ; -"regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_1" [label="1: Start MemoryLeakExample.regularLeak\nFormals: self:MemoryLeakExample*\nLocals: x:int* \n " color=yellow style=filled] - - - "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_1" -> "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_5" ; -"regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_2" [label="2: Exit MemoryLeakExample.regularLeak \n " color=yellow style=filled] - - -"regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_3" [label="3: Return Stmt \n n$45=*&x:int* [line 88, column 11]\n n$46=*n$45:int [line 88, column 10]\n *&return:int=n$46 [line 88, column 3]\n " shape="box"] - - - "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_3" -> "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_2" ; -"regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_4" [label="4: BinaryOperatorStmt: Assign \n n$47=*&x:int* [line 87, column 4]\n *n$47:int=7 [line 87, column 3]\n " shape="box"] - - - "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_4" -> "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_3" ; -"regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_5" [label="5: DeclStmt \n VARIABLE_DECLARED(x:int*); [line 86, column 3]\n n$48=_fun_malloc_no_fail(sizeof(t=int;nbytes=4):int) [line 86, column 12]\n *&x:int*=(int*)n$48 [line 86, column 3]\n " shape="box"] - - - "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_5" -> "regularLeak#MemoryLeakExample#instance.939a892cee505c3459f2d889292f218b_4" ; -"setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_1" [label="1: Start MemoryLeakExample.setAttachmentContainerView:\nFormals: self:MemoryLeakExample* attachmentContainerView:UIView*\nLocals: \n " color=yellow style=filled] - - - "setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_1" -> "setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_3" ; -"setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_2" [label="2: Exit MemoryLeakExample.setAttachmentContainerView: \n " color=yellow style=filled] - - -"setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_3" [label="3: BinaryOperatorStmt: Node \n n$12=*&self:MemoryLeakExample* [line 14, column 27]\n n$13=*&attachmentContainerView:UIView* [line 14, column 27]\n *n$12._attachmentContainerView:UIView*=n$13 [line 14, column 27]\n " shape="box"] - - - "setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_3" -> "setAttachmentContainerView:#MemoryLeakExample(class UIView)#instance.8d85bf92171cba689e1f602ab1f4c0c7_2" ; -"setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_1" [label="1: Start MemoryLeakExample.setBackgroundCoveringView:\nFormals: self:MemoryLeakExample* backgroundCoveringView:UIView*\nLocals: \n " color=yellow style=filled] - - - "setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_1" -> "setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_3" ; -"setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_2" [label="2: Exit MemoryLeakExample.setBackgroundCoveringView: \n " color=yellow style=filled] - - -"setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_3" [label="3: BinaryOperatorStmt: Node \n n$8=*&self:MemoryLeakExample* [line 13, column 27]\n n$9=*&backgroundCoveringView:UIView* [line 13, column 27]\n *n$8._backgroundCoveringView:UIView*=n$9 [line 13, column 27]\n " shape="box"] - - - "setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_3" -> "setBackgroundCoveringView:#MemoryLeakExample(class UIView)#instance.aa3950cc83a096190a5b6798bab718e3_2" ; -"test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_1" [label="1: Start MemoryLeakExample.test\nFormals: self:MemoryLeakExample*\nLocals: shadowPath:CGPath const * \n " color=yellow style=filled] - - - "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_1" -> "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_4" ; -"test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_2" [label="2: Exit MemoryLeakExample.test \n " color=yellow style=filled] - - -"test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_3" [label="3: Message Call: setShadowPath: \n n$9=*&self:MemoryLeakExample* [line 29, column 3]\n n$10=_fun_MemoryLeakExample.backgroundCoveringView(n$9:MemoryLeakExample*) [line 29, column 8]\n n$11=_fun_UIView.layer(n$10:UIView*) [line 29, column 31]\n n$8=*&shadowPath:CGPath const * [line 29, column 50]\n n$12=_fun_CALayer.setShadowPath:(n$11:CALayer*,n$8:CGPath const *) [line 29, column 37]\n " shape="box"] - - - "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_3" -> "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_2" ; -"test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_4" [label="4: DeclStmt \n VARIABLE_DECLARED(shadowPath:CGPath const *); [line 27, column 3]\n n$13=*&self:MemoryLeakExample* [line 28, column 28]\n n$14=_fun_MemoryLeakExample.backgroundCoveringView(n$13:MemoryLeakExample*) [line 28, column 33]\n n$15=_fun_UIView.bounds(n$14:UIView*) [line 28, column 56]\n n$16=_fun_CGPathCreateWithRect(n$15:CGRect,null:CGAffineTransform const *) [line 28, column 7]\n *&shadowPath:CGPath const *=n$16 [line 27, column 3]\n " shape="box"] - - - "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_4" -> "test#MemoryLeakExample#instance.cbb708bfe735ac5e5777524359299e00_3" ; -"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_1" [label="1: Start MemoryLeakExample.testFBColorCreateWithGray\nFormals: self:MemoryLeakExample*\nLocals: borderColor:CGColor* \n " color=yellow style=filled] - - - "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_1" -> "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" ; -"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_2" [label="2: Exit MemoryLeakExample.testFBColorCreateWithGray \n " color=yellow style=filled] - - -"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_3" [label="3: Call _fun_CGColorRelease \n n$42=*&borderColor:CGColor* [line 82, column 18]\n n$43=_fun_CGColorRelease(n$42:CGColor*) [line 82, column 3]\n " shape="box"] - - - "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_3" -> "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_2" ; -"testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" [label="4: DeclStmt \n VARIABLE_DECLARED(borderColor:CGColor*); [line 81, column 3]\n n$44=_fun_FBColorCreateWithGray(0.:double,0.3:double) [line 81, column 28]\n *&borderColor:CGColor*=n$44 [line 81, column 3]\n " shape="box"] - - - "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_4" -> "testFBColorCreateWithGray#MemoryLeakExample#instance.4f74b525e11effa846f82d4205d48a4a_3" ; -} diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m deleted file mode 100644 index 370665587..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface TollBridgeExample : NSObject - -@end - -@implementation TollBridgeExample - -- (void)bridgeTransfer { - CFLocaleRef nameRef = CFLocaleCreate(NULL, NULL); - NSLocale* a = (__bridge_transfer NSLocale*)nameRef; -} - -- (void)bridge { - CFLocaleRef nameRef = CFLocaleCreate(NULL, NULL); - NSLocale* a = (__bridge NSLocale*)nameRef; -} - -- (void)brideRetained { - id observer = [NSLocale alloc]; - CFLocaleRef a = (__bridge_retained CFLocaleRef)observer; -} - -- (void)_readHTTPHeader; -{ - CFDictionaryRef ref = CFHTTPMessageCopyAllHeaderFields(NULL); - CFBridgingRelease(ref); -} - -CTFontRef cfautorelease_test() { - return CFAutorelease(CTFontCreateWithName(CFSTR("Icon"), 17.0, NULL)); -} - -void bridgeDictionaryNoLeak() { - NSDictionary* bufferAttributes = @{(NSString*)@"key" : @{}}; - CFDictionaryRef dict = (__bridge CFDictionaryRef)bufferAttributes; -} - -@end diff --git a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot b/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot deleted file mode 100644 index eb63daf9c..000000000 --- a/infer/tests/codetoanalyze/objc/shared/memory_leaks_benchmark/TollBridgeExample.m.dot +++ /dev/null @@ -1,100 +0,0 @@ -/* @generated */ -digraph cfg { -"bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_1" [label="1: Start bridgeDictionaryNoLeak\nFormals: \nLocals: dict:__CFDictionary const * bufferAttributes:NSDictionary* \n " color=yellow style=filled] - - - "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_1" -> "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_4" ; -"bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_2" [label="2: Exit bridgeDictionaryNoLeak \n " color=yellow style=filled] - - -"bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_3" [label="3: DeclStmt \n VARIABLE_DECLARED(dict:__CFDictionary const *); [line 44, column 3]\n n$0=*&bufferAttributes:NSDictionary* [line 44, column 52]\n *&dict:__CFDictionary const *=n$0 [line 44, column 3]\n " shape="box"] - - - "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_3" -> "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_2" ; -"bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_4" [label="4: DeclStmt \n VARIABLE_DECLARED(bufferAttributes:NSDictionary*); [line 43, column 3]\n n$2=_fun_NSDictionary.dictionaryWithObjects:forKeys:count:(null:objc_object*) [line 43, column 58]\n n$1=_fun_NSString.stringWithUTF8String:(\"key\":char* const ) [line 43, column 49]\n n$3=_fun_NSDictionary.dictionaryWithObjects:forKeys:count:(n$2:objc_object*,n$1:objc_object*,null:objc_object*) [line 43, column 36]\n *&bufferAttributes:NSDictionary*=n$3 [line 43, column 3]\n " shape="box"] - - - "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_4" -> "bridgeDictionaryNoLeak.a9b55a0c8751bf95138aeb6870d0dec1_3" ; -"cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_1" [label="1: Start cfautorelease_test\nFormals: \nLocals: \n " color=yellow style=filled] - - - "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_1" -> "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" ; -"cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_2" [label="2: Exit cfautorelease_test \n " color=yellow style=filled] - - -"cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" [label="3: Return Stmt \n n$0=_fun___builtin___CFStringMakeConstantString(\"Icon\":char*) [line 39, column 45]\n n$1=_fun_CTFontCreateWithName(n$0:__CFString const *,17.:double,null:CGAffineTransform const *) [line 39, column 24]\n n$2=_fun_CFAutorelease(n$1:void const *) [line 39, column 10]\n *&return:__CTFont const *=n$2 [line 39, column 3]\n " shape="box"] - - - "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_3" -> "cfautorelease_test.2ccea2233b65cd3828a2d5e2571ad69b_2" ; -"_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_1" [label="1: Start TollBridgeExample._readHTTPHeader\nFormals: self:TollBridgeExample*\nLocals: ref:__CFDictionary const * \n " color=yellow style=filled] - - - "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_1" -> "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_4" ; -"_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_2" [label="2: Exit TollBridgeExample._readHTTPHeader \n " color=yellow style=filled] - - -"_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_3" [label="3: Call _fun_CFBridgingRelease \n n$6=*&ref:__CFDictionary const * [line 35, column 21]\n n$7=_fun_CFBridgingRelease(n$6:void const *) [line 35, column 3]\n " shape="box"] - - - "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_3" -> "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_2" ; -"_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_4" [label="4: DeclStmt \n VARIABLE_DECLARED(ref:__CFDictionary const *); [line 34, column 3]\n n$8=_fun_CFHTTPMessageCopyAllHeaderFields(null:__CFHTTPMessage*) [line 34, column 25]\n *&ref:__CFDictionary const *=n$8 [line 34, column 3]\n " shape="box"] - - - "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_4" -> "_readHTTPHeader#TollBridgeExample#instance.3d37ce88cf13750e89ba404865a70554_3" ; -"brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_1" [label="1: Start TollBridgeExample.brideRetained\nFormals: self:TollBridgeExample*\nLocals: a:__CFLocale const * observer:objc_object* \n " color=yellow style=filled] - - - "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_1" -> "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_4" ; -"brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_2" [label="2: Exit TollBridgeExample.brideRetained \n " color=yellow style=filled] - - -"brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_3" [label="3: DeclStmt \n VARIABLE_DECLARED(a:__CFLocale const *); [line 29, column 3]\n n$4=*&observer:objc_object* [line 29, column 50]\n *&a:__CFLocale const *=n$4 [line 29, column 3]\n " shape="box"] - - - "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_3" -> "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_2" ; -"brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_4" [label="4: DeclStmt \n VARIABLE_DECLARED(observer:objc_object*); [line 28, column 3]\n n$5=_fun___objc_alloc_no_fail(sizeof(t=NSLocale):unsigned long) [line 28, column 17]\n *&observer:objc_object*=n$5 [line 28, column 3]\n " shape="box"] - - - "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_4" -> "brideRetained#TollBridgeExample#instance.de039e838ea3246eff789fdc0d11405c_3" ; -"bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_1" [label="1: Start TollBridgeExample.bridge\nFormals: self:TollBridgeExample*\nLocals: a:NSLocale* nameRef:__CFLocale const * \n " color=yellow style=filled] - - - "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_1" -> "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_4" ; -"bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_2" [label="2: Exit TollBridgeExample.bridge \n " color=yellow style=filled] - - -"bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_3" [label="3: DeclStmt \n VARIABLE_DECLARED(a:NSLocale*); [line 24, column 3]\n n$2=*&nameRef:__CFLocale const * [line 24, column 37]\n *&a:NSLocale*=n$2 [line 24, column 3]\n " shape="box"] - - - "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_3" -> "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_2" ; -"bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_4" [label="4: DeclStmt \n VARIABLE_DECLARED(nameRef:__CFLocale const *); [line 23, column 3]\n n$3=_fun_CFLocaleCreate(null:__CFAllocator const *,null:__CFString const *) [line 23, column 25]\n *&nameRef:__CFLocale const *=n$3 [line 23, column 3]\n " shape="box"] - - - "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_4" -> "bridge#TollBridgeExample#instance.fadd5a014118113c960fa1a6e3ff27ba_3" ; -"bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_1" [label="1: Start TollBridgeExample.bridgeTransfer\nFormals: self:TollBridgeExample*\nLocals: a:NSLocale* nameRef:__CFLocale const * \n " color=yellow style=filled] - - - "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_1" -> "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_4" ; -"bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_2" [label="2: Exit TollBridgeExample.bridgeTransfer \n " color=yellow style=filled] - - -"bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_3" [label="3: DeclStmt \n VARIABLE_DECLARED(a:NSLocale*); [line 19, column 3]\n n$0=*&nameRef:__CFLocale const * [line 19, column 46]\n *&a:NSLocale*=n$0 [line 19, column 3]\n " shape="box"] - - - "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_3" -> "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_2" ; -"bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_4" [label="4: DeclStmt \n VARIABLE_DECLARED(nameRef:__CFLocale const *); [line 18, column 3]\n n$1=_fun_CFLocaleCreate(null:__CFAllocator const *,null:__CFString const *) [line 18, column 25]\n *&nameRef:__CFLocale const *=n$1 [line 18, column 3]\n " shape="box"] - - - "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_4" -> "bridgeTransfer#TollBridgeExample#instance.d0065913beb197e891ef0d8a0bb81b38_3" ; -"dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_1" [label="1: Start TollBridgeExample.dealloc\nFormals: self:TollBridgeExample*\nLocals: \n " color=yellow style=filled] - - - "dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_1" -> "dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_3" ; -"dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_2" [label="2: Exit TollBridgeExample.dealloc \n " color=yellow style=filled] - - -"dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_3" [label="3: Call dealloc \n " shape="box"] - - - "dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_3" -> "dealloc#TollBridgeExample#instance.c883387ebf7fc6e9cfedaafab66aec43_2" ; -}