xserver: Branch 'server-1.9-branch' - 24 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Mon Apr 4 09:50:05 PDT 2011


 Xext/xtest.c                   |    5 +----
 Xi/exevents.c                  |    8 ++++++--
 Xi/getprop.c                   |    2 +-
 Xi/getselev.c                  |    6 +++---
 Xi/xiquerydevice.c             |    4 +++-
 dix/colormap.c                 |    2 ++
 dix/dixfonts.c                 |   18 +++---------------
 dix/extension.c                |    5 ++---
 fb/fboverlay.c                 |    8 ++++++--
 fb/fbscreen.c                  |    4 ----
 hw/xfree86/common/xf86Config.c |   32 +++++++++++++++++++++++---------
 hw/xfree86/common/xf86Helper.c |    1 +
 hw/xfree86/common/xf86Init.c   |    4 +++-
 hw/xfree86/dri2/dri2.c         |    9 +++++++--
 hw/xfree86/loader/loadmod.c    |    6 ++++++
 mi/micmap.c                    |    2 ++
 mi/midispcur.c                 |   10 +---------
 mi/mipointer.c                 |    1 -
 mi/mispans.c                   |    2 ++
 mi/mizerline.c                 |    6 ++++--
 os/utils.c                     |   19 +++++++------------
 render/render.c                |   25 ++++++++++++-------------
 xfixes/region.c                |    2 --
 xkb/ddxList.c                  |    4 +++-
 24 files changed, 98 insertions(+), 87 deletions(-)

New commits:
commit 90955857b20d0f5431f1c87f76adf1b89ec3f661
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Mar 28 20:24:52 2011 +0300

    xfree86: loader: fix memory leaks in LoaderListDirs
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 615e8c6..4548d7a 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -533,6 +533,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
 				FreePathList(pathlist);
 				FreeSubdirs(subdirs);
 				FreePatterns(patterns);
+				closedir(d);
 				return NULL;
 			    }
 			    listing[n] = malloc(len + 1);
@@ -541,6 +542,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
 				FreePathList(pathlist);
 				FreeSubdirs(subdirs);
 				FreePatterns(patterns);
+				closedir(d);
 				return NULL;
 			    }
 			    strncpy(listing[n], dp->d_name + match[1].rm_so,
@@ -557,6 +559,10 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
     }
     if (listing)
 	listing[n] = NULL;
+
+    FreePathList(pathlist);
+    FreeSubdirs(subdirs);
+    FreePatterns(patterns);
     return listing;
 }
 
commit 593ccaeaaf839d910b26627e80077d3f7feef85d
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Apr 4 17:21:01 2011 +0300

    os: use DebugF for debugging
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/os/utils.c b/os/utils.c
index f0de17e..193992d 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1305,9 +1305,7 @@ System(char *command)
     }
 #endif
 
-#ifdef DEBUG
-    ErrorF("System: `%s'\n", command);
-#endif
+    DebugF("System: `%s'\n", command);
 
     switch (pid = fork()) {
     case -1:	/* error */
@@ -1424,9 +1422,7 @@ Popen(char *command, char *type)
     cur->next = pidlist;
     pidlist = cur;
 
-#ifdef DEBUG
-    ErrorF("Popen: `%s', fp = %p\n", command, iop);
-#endif
+    DebugF("Popen: `%s', fp = %p\n", command, iop);
 
     return iop;
 }
@@ -1501,9 +1497,7 @@ Fopen(char *file, char *type)
     cur->next = pidlist;
     pidlist = cur;
 
-#ifdef DEBUG
-    ErrorF("Fopen(%s), fp = %p\n", file, iop);
-#endif
+    DebugF("Fopen(%s), fp = %p\n", file, iop);
 
     return iop;
 #else
@@ -1532,9 +1526,7 @@ Pclose(pointer iop)
     int pstat;
     int pid;
 
-#ifdef DEBUG
-    ErrorF("Pclose: fp = %p\n", iop);
-#endif
+    DebugF("Pclose: fp = %p\n", iop);
 
     fclose(iop);
 
commit 1cb73083e56d87a2297e3694b5156f61fe95f8a2
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Apr 4 17:14:42 2011 +0300

    xfree86: fix bad free configInputDevices
    
    introduced in 93ca526892c0d22afa05cce6496198c652043a19.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 08204a9..1eda7f8 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1502,8 +1502,9 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
     while (irp) {
 	indp[count] = xnfalloc(sizeof(IDevRec));
 	if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
-	    while(count--)
+	    do {
 		free(indp[count]);
+	    } while(count--);
 	    free(indp);
 	    return FALSE;
 	}
commit 827ac06d05c9f73d59af5e9b4340aaa5dc143713
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 18:22:50 2011 +0300

    render: fix memory leaks in ProcRenderCompositeGlyphs
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Soren Sandmann <ssp at redhat.com>

diff --git a/render/render.c b/render/render.c
index 85a4392..7eaaa57 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1365,8 +1365,10 @@ ProcRenderCompositeGlyphs (ClientPtr client)
     else
     {
 	listsBase = (GlyphListPtr) malloc(nlist * sizeof (GlyphListRec));
-	if (!listsBase)
-	    return BadAlloc;
+	if (!listsBase) {
+	    rc = BadAlloc;
+	    goto bail;
+	}
     }
     buffer = (CARD8 *) (stuff + 1);
     glyphs = glyphsBase;
@@ -1385,13 +1387,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 					     GlyphSetType, client,
 					     DixUseAccess);
 		if (rc != Success)
-		{
-		    if (glyphsBase != glyphsLocal)
-			free(glyphsBase);
-		    if (listsBase != listsLocal)
-			free(listsBase);
-		    return rc;
-		}
+		    goto bail;
 	    }
 	    buffer += 4;
 	}
@@ -1429,8 +1425,10 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	    lists++;
 	}
     }
-    if (buffer > end)
-	return BadLength;
+    if (buffer > end) {
+	rc = BadLength;
+	goto bail;
+    }
 
     CompositeGlyphs (stuff->op,
 		     pSrc,
@@ -1441,13 +1439,14 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 		     nlist,
 		     listsBase,
 		     glyphsBase);
+    rc = Success;
 
+bail:
     if (glyphsBase != glyphsLocal)
 	free(glyphsBase);
     if (listsBase != listsLocal)
 	free(listsBase);
-    
-    return Success;
+    return rc;
 }
 
 static int
commit ba88550b79f436b134012194bf2c2b169e9d3962
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 17:17:40 2011 +0300

    xkb: fix fd leak in XkbDDXListComponent
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 39bd739..88d7620 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -212,8 +212,10 @@ char	tmpname[PATH_MAX];
     list->nFound[what]= 0;
     free(buf);
     buf = malloc(PATH_MAX * sizeof(char));
-    if (!buf)
+    if (!buf) {
+        fclose(in);
         return BadAlloc;
+    }
     while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
 	unsigned flags;
 	register unsigned int i;
commit 865829d2f180df8af259bcef2349765d91790192
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 16:54:14 2011 +0300

    dix: fix memory leak in ProcListExtensions
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/dix/extension.c b/dix/extension.c
index c8e921a..721713a 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -355,9 +355,8 @@ ProcListExtensions(ClientPtr client)
     }
     WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply);
     if (reply.length)
-    {
         WriteToClient(client, total_length, buffer);
-        free(buffer);
-    }
+
+    free(buffer);
     return Success;
 }
commit 40e1054f35851f4a5f02b73bd83c71a59f03d4a1
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 16:48:21 2011 +0300

    mi: fix memory leak in miZeroLine
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/mi/mizerline.c b/mi/mizerline.c
index 07cfbe1..7077b51 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -157,9 +157,11 @@ miZeroLine(
     list_len = (height >= width) ? height : width;
     pspanInit = malloc(list_len * sizeof(DDXPointRec));
     pwidthInit = malloc(list_len * sizeof(int));
-    if (!pspanInit || !pwidthInit)
+    if (!pspanInit || !pwidthInit) {
+	free(pspanInit);
+	free(pwidthInit);
 	return;
-
+    }
     Nspans = 0;
     new_span = TRUE;
     spans  = pspanInit - 1;
commit 9e526a39e0ac6cd0db477a8a79c2067685a4024b
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Mar 28 20:13:11 2011 +0300

    xi: fix memory leak in AddExtensionClient
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6d88151..09ecdb2 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1632,14 +1632,18 @@ AddExtensionClient(WindowPtr pWin, ClientPtr client, Mask mask, int mskidx)
     if (!others)
 	return BadAlloc;
     if (!pWin->optional->inputMasks && !MakeInputMasks(pWin))
-	return BadAlloc;
+	goto bail;
     others->mask[mskidx] = mask;
     others->resource = FakeClientID(client->index);
     others->next = pWin->optional->inputMasks->inputClients;
     pWin->optional->inputMasks->inputClients = others;
     if (!AddResource(others->resource, RT_INPUTCLIENT, (pointer) pWin))
-	return BadAlloc;
+	goto bail;
     return Success;
+
+bail:
+    free(others);
+    return BadAlloc;
 }
 
 static Bool
commit 3468d4dae6c954a9eeeba486c4c0021ef452df85
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Mar 28 20:09:04 2011 +0300

    dix: fix memory leak in AllocShared
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/dix/colormap.c b/dix/colormap.c
index 188378b..0e1feb6 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -2105,6 +2105,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
 	{
 	    for (z++ ; z < npixShared; z++)
 		free(ppshared[z]);
+	    free(psharedList);
 	    return FALSE;
 	}
     }
commit 727bb5b31395eee5dba2d08142684c700225939a
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Mar 28 20:07:06 2011 +0300

    dix: fix memory leak in AllocPseudo
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/dix/colormap.c b/dix/colormap.c
index 2e9a806..188378b 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1879,6 +1879,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
 	{
 	    for (p = ppixTemp; p < ppixTemp + npix; p++)
 		pmap->red[*p].refcnt = 0;
+	    free(ppixTemp);
 	    return BadAlloc;
 	}
 	pmap->clientPixelsRed[client] = ppix;
commit 7f240aaf155763e2c539312d894e8d19d92fe963
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Mon Mar 28 19:21:28 2011 +0300

    os: fix memory and fd leaks in Popen
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>

diff --git a/os/utils.c b/os/utils.c
index 4871326..f0de17e 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1368,6 +1368,9 @@ Popen(char *command, char *type)
     /* Ignore the smart scheduler while this is going on */
     old_alarm = OsSignal(SIGALRM, SIG_IGN);
     if (old_alarm == SIG_ERR) {
+      close(pdes[0]);
+      close(pdes[1]);
+      free(cur);
       perror("signal");
       return NULL;
     }
commit c2f117fc0d3b0d06f64748f88e25c8daaaf772e2
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 20:04:24 2011 +0300

    xfree86: fix memory leak in xf86LoadModules
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ca532ee..0762f86 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1446,8 +1446,10 @@ xf86LoadModules(char **list, pointer *optlist)
 	name = xf86NormalizeName(list[i]);
 
 	/* Skip empty names */
-	if (name == NULL || *name == '\0')
+	if (name == NULL || *name == '\0') {
+	    free(name);
 	    continue;
+	}
 
 	/* Replace obsolete keyboard driver with kbd */
 	if (!xf86NameCmp(name, "keyboard")) {
commit 385e366c151a166435719061e1bf7a9733afa05d
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Tue Mar 29 19:49:32 2011 +0300

    xfree86: fix memory leaks in configLayout
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index a3222b4..08204a9 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1527,7 +1527,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 {
     XF86ConfAdjacencyPtr adjp;
     XF86ConfInactivePtr idp;
-    int count = 0;
+    int saved_count, count = 0;
     int scrnum;
     XF86ConfLayoutPtr l;
     MessageType from;
@@ -1595,6 +1595,9 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 	    scrnum = adjp->adj_scrnum;
 	if (!configScreen(slp[count].screen, adjp->adj_screen, scrnum,
 			  X_CONFIG)) {
+	    do {
+		free(slp[count].screen);
+	    } while(count--);
 	    free(slp);
 	    return FALSE;
 	}
@@ -1683,6 +1686,10 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
 	}
     }
 
+    if (!count)
+	saved_count = 1;
+    else
+	saved_count = count;
     /*
      * Count the number of inactive devices.
      */
@@ -1699,16 +1706,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
     idp = conf_layout->lay_inactive_lst;
     count = 0;
     while (idp) {
-	if (!configDevice(&gdp[count], idp->inactive_device, FALSE)) {
-	    free(gdp);
-	    return FALSE;
-	}
+	if (!configDevice(&gdp[count], idp->inactive_device, FALSE))
+	    goto bail;
         count++;
         idp = (XF86ConfInactivePtr)idp->list.next;
     }
 
     if (!configInputDevices(conf_layout, servlayoutp))
-	return FALSE;
+	goto bail;
 
     servlayoutp->id = conf_layout->lay_identifier;
     servlayoutp->screens = slp;
@@ -1717,6 +1722,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
     from = X_DEFAULT;
 
     return TRUE;
+
+bail:
+    do {
+	free(slp[saved_count].screen);
+    } while(saved_count--);
+    free(slp);
+    free(gdp);
+    return FALSE;
 }
 
 /*
commit 5f2b91309e89d2fa2919625c8d6edc41f3525326
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 22:21:21 2011 +0200

    xfree86: fix memory leak in xf86ConfigFbEntity
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 724c1a1..d9286b7 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1975,6 +1975,7 @@ xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
 
     xf86SetEntityFuncs(entityIndex,init,enter,leave,private);
 
+    free(pEnt);
     return pScrn;
 }
 
commit 8cfaaa81779d9e2d0cb76d39910f25fcc877f045
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 22:10:55 2011 +0200

    fb: fix memory leak in fbOverlayFinishScreenInit
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/fb/fboverlay.c b/fb/fboverlay.c
index 7fca89c..45e6370 100644
--- a/fb/fboverlay.c
+++ b/fb/fboverlay.c
@@ -390,12 +390,16 @@ fbOverlayFinishScreenInit(ScreenPtr	pScreen,
    
     if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1,
 			&defaultVisual, ((unsigned long)1<<(bpp1-1)) |
-			((unsigned long)1<<(bpp2-1)), 8))
+			((unsigned long)1<<(bpp2-1)), 8)) {
+	free(pScrPriv);
 	return FALSE;
+    }
     if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
 			depth1, ndepths, depths,
-			defaultVisual, nvisuals, visuals))
+			defaultVisual, nvisuals, visuals)) {
+	free(pScrPriv);
 	return FALSE;
+    }
     /* MI thinks there's no frame buffer */
 #ifdef MITSHM
     ShmRegisterFbFuncs(pScreen);
commit 491d6060885147b14f0947a12aed14cc5bf69d2d
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 22:07:44 2011 +0200

    Xi: fix memory leak in ProcXGetSelectedExtensionEvents
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/getselev.c b/Xi/getselev.c
index 09a53f4..7304738 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -152,8 +152,8 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
     if (total_length) {
 	client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
 	WriteSwappedDataToClient(client, total_length, buf);
-	free(buf);
     }
+    free(buf);
     return Success;
 }
 
commit 5edb3822b9cdbae3b67b1916e4a6498a26c0facf
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 22:07:31 2011 +0200

    dix: fix memory leak in SetDefaultFontPath
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 0f71d52..77be12d 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1825,8 +1825,10 @@ SetDefaultFontPath(char *path)
     /* get enough for string, plus values -- use up commas */
     len = strlen(temp_path) + 1;
     nump = cp = newpath = malloc(len);
-    if (!newpath)
+    if (!newpath) {
+	free(temp_path);
 	return BadAlloc;
+    }
     pp = (unsigned char *) temp_path;
     cp++;
     while (*pp) {
commit 009b226a486ae3a27fea2784c2bca0ab9a78091d
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 21:33:15 2011 +0200

    mi: fix memory leak in miFillUniqueSpanGroup
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/mi/mispans.c b/mi/mispans.c
index 9f56e3c..58fdd93 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -458,6 +458,8 @@ void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
 			    }
 			    free(yspans);
 			    free(ysizes);
+			    free(newpoints);
+			    free(newwidths);
 			    miDisposeSpanGroup (spanGroup);
 			    return;
 			}
commit 2a2f15e34747869f1195908cf52dcfe72a6ffaa4
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 19:27:17 2011 +0200

    xi: fix memory leak in ProcXIQueryDevice
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index 303c8b2..a2560c0 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -107,8 +107,10 @@ ProcXIQueryDevice(ClientPtr client)
     }
 
     info = calloc(1, len);
-    if (!info)
+    if (!info) {
+        free(skip);
         return BadAlloc;
+    }
 
     memset(&rep, 0, sizeof(xXIQueryDeviceReply));
     rep.repType = X_Reply;
commit b6224b3dd85943e0346abca318c07f56a919a3df
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 19:21:03 2011 +0200

    mi: fix memory leak in miInitVisuals
    
    Free the pointers inside miInitVisuals, so the callers of this function
    (fboverlay.c and fbscreen.c) don't need to worry with deallocation in the case
    of failure.
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 2502efe..c5b35ac 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -225,11 +225,7 @@ fbFinishScreenInit(ScreenPtr	pScreen,
     rootdepth = 0;
     if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
 			&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
-    {
-	free(visuals);
-	free(depths);
 	return FALSE;
-    }
     if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
 			rootdepth, ndepths, depths,
 			defaultVisual, nvisuals, visuals))
diff --git a/mi/micmap.c b/mi/micmap.c
index 8d76f4d..e3ff9e4 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -564,6 +564,8 @@ miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
 	{
 	    vid = malloc(nvtype * sizeof (VisualID));
 	    if (!vid) {
+	        free(depth);
+	        free(visual);
 		free(preferredCVCs);
 		return FALSE;
 	    }
commit 518109e20012efcebafb05ab2454e353ef386655
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 18:56:02 2011 +0200

    xfree86: dri2: fix memory leak and free resources properly
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 39996f9..11834e4 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -221,11 +221,16 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
     if (ref == NULL)
 	return BadAlloc;
 	
-    if (!AddResource(dri2_id, dri2DrawableRes, pPriv))
+    if (!AddResource(dri2_id, dri2DrawableRes, pPriv)) {
+	free(ref);
 	return BadAlloc;
+    }
     if (!DRI2LookupDrawableRef(pPriv, id))
-	if (!AddResource(id, dri2DrawableRes, pPriv))
+	if (!AddResource(id, dri2DrawableRes, pPriv)) {
+	    FreeResourceByType(dri2_id, dri2DrawableRes, TRUE);
+	    free(ref);
 	    return BadAlloc;
+        }
 
     ref->id = id;
     ref->dri2_id = dri2_id; 
commit 66c86ca867c070f5e3ccad471c9655cbb23ef7a1
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Fri Mar 25 18:24:34 2011 +0200

    xorg: remove unused pointer values all over the server
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 7268768..8698f55 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -392,10 +392,7 @@ ProcXTestFakeInput(ClientPtr client)
             if (!dev->valuator)
                 return BadDevice;
 
-            /* broken lib, XI events have root uninitialized */
-            if (extension || ev->u.keyButtonPointer.root == None)
-                root = GetCurrentRootWindow(dev);
-            else
+            if (!(extension || ev->u.keyButtonPointer.root == None))
             {
                 rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
                                      client, DixGetAttrAccess);
diff --git a/Xi/getprop.c b/Xi/getprop.c
index ba98fc8..5e10262 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -115,7 +115,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
 
     if ((others = wOtherInputMasks(pWin)) != 0) {
 	for (i = 0; i < EMASKSIZE; i++)
-	    tbuf = ClassFromMask(NULL, others->dontPropagateMask[i], i,
+	    ClassFromMask(NULL, others->dontPropagateMask[i], i,
 				 &count, COUNT);
 	if (count) {
 	    rep.count = count;
diff --git a/Xi/getselev.c b/Xi/getselev.c
index d63b661..09a53f4 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -118,13 +118,13 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
     if ((pOthers = wOtherInputMasks(pWin)) != 0) {
 	for (others = pOthers->inputClients; others; others = others->next)
 	    for (i = 0; i < EMASKSIZE; i++)
-		tclient = ClassFromMask(NULL, others->mask[i], i,
+		ClassFromMask(NULL, others->mask[i], i,
 					&rep.all_clients_count, COUNT);
 
 	for (others = pOthers->inputClients; others; others = others->next)
 	    if (SameClient(others, client)) {
 		for (i = 0; i < EMASKSIZE; i++)
-		    tclient = ClassFromMask(NULL, others->mask[i], i,
+		    ClassFromMask(NULL, others->mask[i], i,
 					    &rep.this_client_count, COUNT);
 		break;
 	    }
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 28786ba..a3222b4 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -312,7 +312,7 @@ xf86ModulelistFromConfig(pointer **optlist)
             }
             if (found == FALSE) {
 		XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
-	            ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+                xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
                 xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
             }
          }
@@ -321,7 +321,7 @@ xf86ModulelistFromConfig(pointer **optlist)
 	for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
 	    if (ModuleDefaults[i].toLoad == TRUE) {
 		XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
-		ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+		xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
 	    }
 	}
     }
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 323ee02..def2a52 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -401,7 +401,6 @@ Bool
 miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
                  int x, int y, unsigned long source, unsigned long mask)
 {
-    miDCScreenPtr   pScreenPriv;
     miDCCursorPtr   pPriv;
     miDCBufferPtr   pBuffer;
     WindowPtr	    pWin;
@@ -414,8 +413,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
 	if (!pPriv)
 	    return FALSE;
     }
-    pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
-						  miDCScreenKey);
+
     pWin = pScreen->root;
     pBuffer = miGetDCDevice(pDev, pScreen);
 
@@ -448,14 +446,11 @@ Bool
 miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
                      int x, int y, int w, int h)
 {
-    miDCScreenPtr   pScreenPriv;
     miDCBufferPtr   pBuffer;
     PixmapPtr	    pSave;
     WindowPtr	    pWin;
     GCPtr	    pGC;
 
-    pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
-						  miDCScreenKey);
     pBuffer = miGetDCDevice(pDev, pScreen);
 
     pSave = pBuffer->pSave;
@@ -482,14 +477,11 @@ Bool
 miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
                         int x, int y, int w, int h)
 {
-    miDCScreenPtr   pScreenPriv;
     miDCBufferPtr   pBuffer;
     PixmapPtr	    pSave;
     WindowPtr	    pWin;
     GCPtr	    pGC;
 
-    pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
-						  miDCScreenKey);
     pBuffer = miGetDCDevice(pDev, pScreen);
     pSave = pBuffer->pSave;
 
diff --git a/mi/mipointer.c b/mi/mipointer.c
index d8aaf8c..a71116c 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -511,7 +511,6 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
 		pScreen = newScreen;
 		(*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
 							     FALSE);
-		pScreenPriv = GetScreenPrivate (pScreen);
 	    	/* Smash the confine to the new screen */
                 pPointer->limits.x2 = pScreen->width;
                 pPointer->limits.y2 = pScreen->height;
diff --git a/xfixes/region.c b/xfixes/region.c
index 42d5d7c..e2bbaa1 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -757,13 +757,11 @@ ProcXFixesSetPictureClipRegion (ClientPtr client)
     PicturePtr		pPicture;
     RegionPtr		pRegion;
     ScreenPtr		pScreen;
-    PictureScreenPtr	ps;
     REQUEST(xXFixesSetPictureClipRegionReq);
     
     REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
     VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     pScreen = pPicture->pDrawable->pScreen;
-    ps = GetPictureScreen (pScreen);
     VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
     
     return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
commit e336c8199c70a063f7be8f7d26023d52927eaf42
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Wed Mar 23 18:08:29 2011 +0200

    dix: remove unused macro
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 722921a..0f71d52 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -70,8 +70,6 @@ Equipment Corporation.
 #include "xf86bigfontsrv.h"
 #endif
 
-#define QUERYCHARINFO(pci, pr)  *(pr) = (pci)->metrics
-
 extern pointer fosNaturalParams;
 extern FontPtr defaultFont;
 
commit 57e5c52ff0f1c63b0caad0121030fdec28904e2f
Author: Tiago Vignatti <tiago.vignatti at nokia.com>
Date:   Wed Mar 23 18:06:51 2011 +0200

    dix: remove unused debug code
    
    Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Nicolas Peninguy <nico at lostgeeks.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index e22eabe..722921a 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -66,10 +66,6 @@ Equipment Corporation.
 #include "dixfont.h"
 #include "xace.h"
 
-#ifdef DEBUG
-#include	<stdio.h>
-#endif
-
 #ifdef XF86BIGFONT
 #include "xf86bigfontsrv.h"
 #endif
@@ -391,14 +387,6 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
     int         i;
     FontPtr     cached = (FontPtr)0;
 
-#ifdef FONTDEBUG
-    char *f;
-    f = malloc(lenfname + 1);
-    memmove(f, pfontname, lenfname);
-    f[lenfname] = '\0';
-    ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f);
-    free(f);
-#endif
     if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
 	return BadName;
     if (patternCache)


More information about the xorg-commit mailing list