if (FName.equals("pthread_setspecific"))
return false;
+ // White list xpc connection context.
+ // TODO: Ensure that the deallocation actually happens, need to reason
+ // about "xpc_connection_set_finalizer_f".
+ if (FName.equals("xpc_connection_set_context"))
+ return false;
+
// White list the 'XXXNoCopy' ObjC functions.
if (FName.endswith("NoCopy")) {
// Look for the deallocator argument. We know that the memory ownership
// object doesn't escape and it hasn't been freed in this function.
}
+// Allow xpc context to escape. radar://11635258
+// TODO: Would be great if we checked that the finalize_connection_context actually releases it.
+static void finalize_connection_context(void *ctx) {
+ int *context = ctx;
+ free(context);
+}
+void foo (xpc_connection_t peer) {
+ int *ctx = calloc(1, sizeof(int));
+ xpc_connection_set_context(peer, ctx);
+ xpc_connection_set_finalizer_f(peer, finalize_connection_context);
+ xpc_connection_resume(peer);
+}
+
CGColorSpaceRef space,
CGBitmapInfo bitmapInfo*/);
void *CGBitmapContextGetData(CGContextRef context);
+
+// Include xpc.
+typedef struct _xpc_connection_s * xpc_connection_t;
+typedef void (*xpc_finalizer_t)(void *value);
+void xpc_connection_set_context(xpc_connection_t connection, void *context);
+void xpc_connection_set_finalizer_f(xpc_connection_t connection, xpc_finalizer_t finalizer);
+void xpc_connection_resume(xpc_connection_t connection);