From 28211c443c693a1ca3db5740d0128274a3eef723 Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Thu, 13 May 2010 03:43:04 +0700 Subject: Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3) Signed-off-by: Mikhail Gusarov Reviewed-by: Keith Packard --- dix/atom.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dix/atom.c') diff --git a/dix/atom.c b/dix/atom.c index ecfe4b0c7..6910dd5d1 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); } -- cgit v1.2.3