[PATCH] Fix property and selection devPrivate allocation.

Eamon Walsh ewalsh at tycho.nsa.gov
Mon Aug 23 13:04:03 PDT 2010


Selection objects were not being allocated with privates, and both
objects had a stray statement that zeroed out the devPrivates field.

Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
Reported-by: Justin Mattock <justinmattock at gmail.com>
---
 dix/property.c  |    1 -
 dix/selection.c |    3 +--
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/dix/property.c b/dix/property.c
index 87e5c2d..1d4332a 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -284,7 +284,6 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
         pProp->format = format;
         pProp->data = data;
 	pProp->size = len;
-	pProp->devPrivates = NULL;
 	rc = XaceHookPropertyAccess(pClient, pWin, &pProp,
 				    DixCreateAccess|DixWriteAccess);
 	if (rc != Success) {
diff --git a/dix/selection.c b/dix/selection.c
index bae3a30..87ed1ab 100644
--- a/dix/selection.c
+++ b/dix/selection.c
@@ -196,12 +196,11 @@ ProcSetSelectionOwner(ClientPtr client)
 	/*
 	 * It doesn't exist, so add it...
 	 */
-	pSel = malloc(sizeof(Selection));
+	pSel = dixAllocateObjectWithPrivates(Selection, PRIVATE_SELECTION);
 	if (!pSel)
 	    return BadAlloc;
 
 	pSel->selection = stuff->selection;
-	pSel->devPrivates = NULL;
 
 	/* security creation/labeling check */
 	rc = XaceHookSelectionAccess(client, &pSel,
-- 
1.7.2.1




More information about the xorg-devel mailing list