summaryrefslogtreecommitdiffstats
path: root/macos.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-11 20:52:54 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-11 20:52:54 -0700
commit1afe36840ddbc2d139c1f7e2b3607aecc88d9890 (patch)
tree8917ae5dd3b886000a141073539bb23e35db0a76 /macos.c
parentbe941e00b20cc0b8b3b46e04200ce15c3023ad23 (diff)
downloadsubsurface-1afe36840ddbc2d139c1f7e2b3607aecc88d9890.tar.gz
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>
Diffstat (limited to 'macos.c')
-rw-r--r--macos.c2
1 files changed, 1 insertions, 1 deletions
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;