Fix memory handling error on MacOS

We are not allowed to free a string that we get back from the config APIs. So
strdup it instead to be compatible with Linux in that respect.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-09-11 20:52:54 -07:00
parent be941e00b2
commit 1afe36840d

View file

@ -54,7 +54,7 @@ const void *subsurface_get_conf(char *name, pref_type_t type)
strpref = CFPreferencesCopyAppValue(CFSTR_VAR(name), SUBSURFACE_PREFERENCES);
if (!strpref)
return NULL;
return CFStringGetCStringPtr(strpref, kCFStringEncodingMacRoman);
return strdup(CFStringGetCStringPtr(strpref, kCFStringEncodingMacRoman));
}
/* we shouldn't get here, but having this line makes the compiler happy */
return NULL;