diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c
index 5347d0e..a4edffb 100644
--- a/MagickCore/xwindow.c
+++ b/MagickCore/xwindow.c
@@ -389,6 +389,12 @@
}
if (windows->class_hints != (XClassHint *) NULL)
{
+ if (windows->class_hints->res_name != (char *) NULL)
+ windows->class_hints->res_name=DestroyString(
+ windows->class_hints->res_name);
+ if (windows->class_hints->res_class != (char *) NULL)
+ windows->class_hints->res_class=DestroyString(
+ windows->class_hints->res_class);
XFree(windows->class_hints);
windows->class_hints=(XClassHint *) NULL;
}