Q:

Objective-C: const char* string getting corrupted: what's going on?

I'm encountering a weird issue where a const char string is getting corrupted after it's been initialised.
In my .m file I have a pointer declared like so:
const char *s;

@implementation MyClass
...
@end 

It's initialised in -init, and looks fine at that point:
-init 
{
    if (self = [super init]) {
        s = [@"obfuscatedString" deobfuscatedCString];
    }
    return self;
}

Later, when I come to read it, the address of the pointer is unchanged, but the value's been overwritten.
I've stripped it down to the bare essentials, and can confirm that the string is not otherwise used, and there doesn't appear to be anything else that might corrupt it.
So, what's going on? Is there some fundamental bit of objective-c I'm not aware of?
Any help would be greatly appreciated. 

A:

Does deobfuscatedCString use autorelease objects when deobfuscating? maybe the returned address points to memory that gets freed when one of them gets dealloced.
If that is the case and you still want s to be a char *, try:
s = strdup([@"obfuscatedString" deobfuscatedCString]);

