Index: /branches/1.2/xcache.c
===================================================================
--- /branches/1.2/xcache.c	(revision 457)
+++ /branches/1.2/xcache.c	(revision 465)
@@ -1461,9 +1461,10 @@
 
 err:
-	xc_destroy();
 	if (xc_php_caches || xc_var_caches) {
+		xc_destroy();
 		/* shm destroied in xc_destroy() */
 	}
 	else if (shm) {
+		xc_destroy();
 		xc_shm_destroy(shm);
 	}
