summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-03-26 22:22:32 -0700
committerKeith Packard <keithp@keithp.com>2009-05-08 22:56:56 -0700
commit0fbf6f30f771e60714fb3003a9bb1a6b79e50c6e (patch)
treeefc1ff711e3e51ffe7c540606c23eb00ffce1ac2
parent773e4890b385a229b0919b4a249714d0bb7171a2 (diff)
Don't leak default font path when appending built-ins
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> (cherry picked from commit 66539cc05d0b017b9feb4a038499907810140623) Signed-off-by: Keith Packard <keithp@keithp.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 17223a123..9e56ca9ce 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -601,7 +601,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;
@@ -617,7 +619,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;