Apparently memset doesn't complain if the memory area is null (addr) and
something is being written there. Even though, this patch guarantees that
nothing is written at 0x0 memory address.

Signed-off-by: Tiago Vignatti <[email protected]>
---
Honestly I didn't check if the code surrounding this hunk of code really needs
or not this memset. I created the patch focused only in the actual problem.

 dix/privates.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dix/privates.c b/dix/privates.c
index ec818d4..4451aae 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -271,8 +271,9 @@ _dixInitPrivates(PrivatePtr *privates, void *addr, 
DevPrivateType type)
        keys[PRIVATE_XSELINUX].created++;
     if (keys[type].offset == 0)
        addr = 0;
+    else
+       memset(addr, '\0', keys[type].offset);
     *privates = addr;
-    memset(addr, '\0', keys[type].offset);
 }
 
 /*
-- 
1.7.1.226.g770c5

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to