fix: avoid segfault at exit when using custom memory functions

This extends the fix introduced by 956534e to Windows processes
dynamically loading libxml2.

Closes #256.
diff --git a/parser.c b/parser.c
index c9312fa..255bd25 100644
--- a/parser.c
+++ b/parser.c
@@ -14672,7 +14672,8 @@
 	return;
 
 #if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
-	atexit(xmlCleanupParser);
+    if (xmlFree == free)
+        atexit(xmlCleanupParser);
 #endif
 
 #ifdef LIBXML_THREAD_ENABLED