From 1afe36840ddbc2d139c1f7e2b3607aecc88d9890 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 11 Sep 2012 20:52:54 -0700 Subject: 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 --- macos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'macos.c') diff --git a/macos.c b/macos.c index fbf399890..f2e58338e 100644 --- a/macos.c +++ b/macos.c @@ -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; -- cgit v1.2.3-70-g09d2