Index: trunk/xcache.c
===================================================================
--- trunk/xcache.c	(revision 130)
+++ trunk/xcache.c	(revision 131)
@@ -559,5 +559,7 @@
 	i = 1;
 	zend_hash_add(&EG(included_files), xce->name.str.val, xce->name.str.len+1, (void *)&i, sizeof(int), NULL);
-	zend_llist_add_element(&CG(open_files), h);
+	if (h) {
+		zend_llist_add_element(&CG(open_files), h);
+	}
 
 #ifndef ZEND_ENGINE_2
@@ -939,7 +941,6 @@
 
 	if (xc_test && stored_xce) {
-		/* no install, keep open_files too for h */
+		/* free it, no install. restore now */
 		xc_sandbox_free(&sandbox, 0 TSRMLS_CC);
-		sandbox.tmp_open_files->dtor = NULL;
 	}
 	else {
@@ -956,4 +957,5 @@
 		destroy_op_array(op_array TSRMLS_CC);
 		efree(op_array);
+		h = NULL;
 		goto restore;
 	}
