Summary: Because in the real semantics CFRelease can be used more than once, and also the variables can be used after CFRelease in general, modelling this as `free` causes many `USE_AFTER_FREE` errors. Now we change the model to not add the `Invalid CFree` attribute, but to just remove the `Allocated` attribute. So we can model memory leaks in the simple case of `Create` and not `CFRelease` before going out of scope, but we avoid the `USE_AFTER_FREE`. Since the model for CFRelease now diverges from free, changed the command line option for modelling to `pulse-model-release-pattern`. Reviewed By: jvillard Differential Revision: D21324895 fbshipit-source-id: ab323d981master
parent
2674631e59
commit
40143ab01c
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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 <UIKit/UIKit.h>
|
||||
|
||||
static CFStringRef use_after_cfrelease_ok(CFStringRef message) {
|
||||
CFRetain(message);
|
||||
CFStringRef lastMessage = message;
|
||||
CFRelease(lastMessage);
|
||||
lastMessage = message;
|
||||
CFRelease(lastMessage);
|
||||
lastMessage = message;
|
||||
|
||||
return lastMessage;
|
||||
}
|
Loading…
Reference in new issue