summaryrefslogtreecommitdiff
path: root/fc-cat
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2005-11-01 05:52:28 +0000
committerPatrick Lam <plam@MIT.EDU>2005-11-01 05:52:28 +0000
commitd6946c1a11695eb55a3fe60db5480df94570b1ba (patch)
treecae54fba028bd91d0fe2aedafc2813e29f6cafde /fc-cat
parente77c17184a6172d6368dd3193c791c4027065bbd (diff)
Fix small memory error (tried to free argv); use basename and dirname
correctly (they can modify their arguments).
Diffstat (limited to 'fc-cat')
-rw-r--r--fc-cat/fc-cat.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
index a392327..4f5b71d 100644
--- a/fc-cat/fc-cat.c
+++ b/fc-cat/fc-cat.c
@@ -198,13 +198,11 @@ FcCacheFileRead (FcFontSet * set, FcStrSet *dirs, char * dir, char *cache_file)
goto bail1;
close(fd);
- free (cache_file);
return FcTrue;
bail1:
close (fd);
bail:
- free (cache_file);
return FcFalse;
}
@@ -327,7 +325,7 @@ main (int argc, char **argv)
i = 1;
#endif
- if (FcCacheFileRead (fs, dirs, dirname (argv[i]), argv[i]))
+ if (FcCacheFileRead (fs, dirs, dirname (strdup(argv[i])), argv[i]))
FcCachePrintSet (fs, dirs, argv[i]);
FcStrSetDestroy (dirs);