20017b
From 3c925b18fa96043e5d7e86f9ce544b143c3c2079 Mon Sep 17 00:00:00 2001
20017b
From: Remi Collet <remi@php.net>
20017b
Date: Mon, 27 Oct 2014 07:45:34 +0100
20017b
Subject: [PATCH] Fix bug #63595 GMP memory management conflicts with other
20017b
 libraries using GMP
20017b
20017b
Drop use of php memory allocators as this raise various conflicts
20017b
with other extensions and libraries which use libgmp.
20017b
20017b
No other solution found.
20017b
We cannot for ensure correct use of allocator with shared lib.
20017b
20017b
Some memory can allocated before php init
20017b
Some memory can be freed after php shutdown
20017b
20017b
Known broken run cases
20017b
- php + curl + gnutls + gmp
20017b
- mod_gnutls + mod_php + gnutls + gmp
20017b
- php + freetds + gnutls + gmp
20017b
- php + odbc + freetds + gnutls + gmp
20017b
- php + php-mapi (zarafa) + gnutls + gmp
20017b
---
20017b
 ext/gmp/gmp.c | 26 --------------------------
20017b
 1 file changed, 26 deletions(-)
20017b
20017b
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
20017b
index f51bd8c..b1553fa 100644
20017b
--- a/ext/gmp/gmp.c
20017b
+++ b/ext/gmp/gmp.c
20017b
@@ -324,30 +324,6 @@ static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
20017b
 #	define MAX_BASE 36
20017b
 #endif
20017b
 
20017b
-/* {{{ gmp_emalloc
20017b
- */
20017b
-static void *gmp_emalloc(size_t size)
20017b
-{
20017b
-	return emalloc(size);
20017b
-}
20017b
-/* }}} */
20017b
-
20017b
-/* {{{ gmp_erealloc
20017b
- */
20017b
-static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
20017b
-{
20017b
-	return erealloc(ptr, new_size);
20017b
-}
20017b
-/* }}} */
20017b
-
20017b
-/* {{{ gmp_efree
20017b
- */
20017b
-static void gmp_efree(void *ptr, size_t size)
20017b
-{
20017b
-	efree(ptr);
20017b
-}
20017b
-/* }}} */
20017b
-
20017b
 /* {{{ ZEND_GINIT_FUNCTION
20017b
  */
20017b
 static ZEND_GINIT_FUNCTION(gmp)
20017b
@@ -369,8 +345,6 @@ ZEND_MODULE_STARTUP_D(gmp)
20017b
 #endif
20017b
 	REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
20017b
 
20017b
-	mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
20017b
-
20017b
 	return SUCCESS;
20017b
 }
20017b
 /* }}} */
20017b
-- 
20017b
2.1.4
20017b