• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Correct Order for CFRelease-ing CFNetwork Refs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Correct Order for CFRelease-ing CFNetwork Refs?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: newb- Overwriting a file or folder
  • Next by Date: Trying to display a static image on my window. Any tips would be great
  • Previous by thread: Re: newb- Overwriting a file or folder
  • Next by thread: Re: Correct Order for CFRelease-ing CFNetwork Refs?
  • Index(es):
    • Date
    • Thread