Can I free a C string after passing it to [NSString stringWithFormat:] with %s? For example:
char *str = malloc(...);
// ... populate str ...
NSString *message = [NSString stringWithFormat:@"[%s]", str];
free(str); // should this be here, or after I'm done with message?
You can safely free the char buffer immediately after creating the NSString. NSStrings always copy data passed to them. This guarantees their immutability.