Fix warning: it's safe to pass atom strings > XA_LAST_PREDEFINED to free(3)

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Mikhail Gusarov 2010-05-13 03:43:04 +07:00
parent 8b5326aa98
commit 28211c443c

View File

@ -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);
}