summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-03-26 22:22:32 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-04-07 10:08:56 -0700
commit66539cc05d0b017b9feb4a038499907810140623 (patch)
treec1e2be9c50407a166680b86bf9bbf6f7bb7efaf8
parent0cfd48130842685828e0662a27272a3a65facd23 (diff)
Don't leak default font path when appending built-ins
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--hw/xfree86/common/xf86Config.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 9a25c7bca..7da85ea2f 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -597,7 +597,9 @@ configFiles(XF86ConfFilesPtr fileconf)
defaultFontPath = Xprintf("%s%s%s",
fileconf->file_fontpath,
*temp_path ? "," : "", temp_path);
- must_copy = FALSE;
+ if (defaultFontPath != NULL) {
+ must_copy = FALSE;
+ }
}
else
defaultFontPath = fileconf->file_fontpath;
@@ -613,7 +615,14 @@ configFiles(XF86ConfFilesPtr fileconf)
!((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) {
defaultFontPath = Xprintf("%s%sbuilt-ins",
temp_path, *temp_path ? "," : "");
- must_copy = FALSE;
+ if (must_copy == TRUE) {
+ if (defaultFontPath != NULL) {
+ must_copy = FALSE;
+ }
+ } else {
+ /* already made a copy of the font path */
+ xfree(temp_path);
+ }
}
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;