Correct Order for CFRelease-ing CFNetwork Refs?
Correct Order for CFRelease-ing CFNetwork Refs?
- Subject: Correct Order for CFRelease-ing CFNetwork Refs?
- From: Jonathan Hohle <email@hidden>
- Date: Tue, 1 Jul 2008 06:09:31 -0700
I recently wrote some code to retrieve data from an NTLM authenticated
web server. As far as I can tell NTLM isn't supported at the Cocoa
level, so I used CFNetwork to make the request. The example docs were
clear and helpful, but I couldn't find anything on deallocating a
CFHTTPAuthenticationRef.
The example code saves off the CFHTTPAuthenticationRef for reuse, a
pattern which I followed. In my -dealloc method, I was calling
CFRelease with the request ref (which may or may not have an
authentication ref applied to it), followed by CFRelease with the
authentication ref. This consistently crashed with EXC_BAD_ACCESS. By
chance, I switched the order, and now the code works without crashing.
Is this the proper order an auth ref and a request should be released?
If I've applied an auth ref, am I responsible for releasing it (I
would assume so)?
As an aside, I found that seting
kCFStreamPropertyHTTPShouldAutoredirect to true on my read stream
while using NTLM authentication doesn't work because you never have
access the forwarded request to apply an auth ref to. Has anyone else
run into this behavior?
Thanks for your help!
Jon
<><
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden