Patch interned_string_double_free_fix for APC Bug #61238
Patch version 2012-03-06 09:32 UTC
Return to Bug #61238 |
Download this patch
Patch Revisions:
Developer: ab@php.net
Index: apc_zend.h
===================================================================
--- apc_zend.h (revision 323906)
+++ apc_zend.h (working copy)
@@ -179,6 +179,19 @@
# define ZEND_CE_BUILTIN_FUNCTIONS(ce) (ce)->builtin_functions
#endif
+#ifdef ZEND_ENGINE_2_4
+
+#define ZEND_STR_INTERN_DUP(str, len) \
+ do { \
+ const char *tmp = (str); \
+ tmp = apc_new_interned_string(tmp, len+1 TSRMLS_CC); \
+ if ((str) == tmp) { \
+ (str) = zend_strndup(tmp, len); \
+ } \
+ } while (0); \
+
+#endif
+
#endif /* APC_ZEND_H */
/*
Index: apc_string.c
===================================================================
--- apc_string.c (revision 323906)
+++ apc_string.c (working copy)
@@ -29,6 +29,7 @@
#include "apc.h"
#include "apc_globals.h"
+#include "apc_zend.h"
#include "apc_php.h"
#include "apc_lock.h"
@@ -147,7 +148,7 @@
}
if (ce->name) {
- ce->name = apc_new_interned_string(ce->name, ce->name_length+1 TSRMLS_CC);
+ ZEND_STR_INTERN_DUP(ce->name, ce->name_length)
}
q = ce->properties_info.pListHead;
@@ -159,7 +160,7 @@
}
if (info->name) {
- info->name = apc_new_interned_string(info->name, info->name_length+1 TSRMLS_CC);
+ ZEND_STR_INTERN_DUP(info->name, info->name_length)
}
q = q->pListNext;
|