summaryrefslogtreecommitdiff
path: root/hw/xwin
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2011-10-30 18:04:59 -0200
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2011-11-24 17:47:37 -0200
commit3d635fe84d6de53e2f74203b10e89f7851fe3fc1 (patch)
treea4b03f2447c1c1551da9216d468b390203b7c6a6 /hw/xwin
parent0ae087e13192d9b498db782be5ba49ca91a81547 (diff)
Correctly free config file names
We call xf86penConfigDirFiles twice, so we overwrite the configDirPath variable, losing the pointer. If we move the pointer management to the upper layer (the function callers), they will be able to call these functions as many times as they want, but they'll have to free those returned values. v2: don't leak inside XWin 4,097 bytes in 1 blocks are definitely lost in loss record 625 of 632 at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so) by 0x4D7899: DoSubstitution (scan.c:615) by 0x4D87B0: OpenConfigDir (scan.c:845) by 0x4D8A2D: xf86openConfigDirFiles (scan.c:955) by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327) by 0x49A9BF: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Diffstat (limited to 'hw/xwin')
-rw-r--r--hw/xwin/winconfig.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index 76bf8e2de..4dbbe7ced 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -117,7 +117,7 @@ Bool
winReadConfigfile ()
{
Bool retval = TRUE;
- const char *filename, *dirname;
+ char *filename, *dirname;
MessageType filefrom = X_DEFAULT;
MessageType dirfrom = X_DEFAULT;
char *xf86ConfigFile = NULL;
@@ -169,6 +169,8 @@ winReadConfigfile ()
{
return FALSE;
}
+ free(filename);
+ free(dirname);
if ((g_xf86configptr = xf86readConfigFile ()) == NULL)
{
winMsg (X_ERROR, "Problem parsing the config file\n");