[PATCH 1/4] Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3)
Mikhail Gusarov
dottedmag at dottedmag.net
Wed May 12 13:56:34 PDT 2010
Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
dix/atom.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dix/atom.c b/dix/atom.c
index ecfe4b0..6910dd5 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -180,8 +180,13 @@ FreeAtom(NodePtr patom)
FreeAtom(patom->left);
if(patom->right)
FreeAtom(patom->right);
- if (patom->a > XA_LAST_PREDEFINED)
- free(patom->string);
+ if (patom->a > XA_LAST_PREDEFINED) {
+ /*
+ * All strings above XA_LAST_PREDEFINED are strdup'ed, so it's safe to
+ * cast here
+ */
+ free((char *)patom->string);
+ }
free(patom);
}
--
1.7.1
More information about the xorg-devel
mailing list