aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/php7-xhprof/6507a35d72e9598700e37208c482329594fd3b41.patch48
-rw-r--r--testing/php7-xhprof/APKBUILD8
2 files changed, 53 insertions, 3 deletions
diff --git a/testing/php7-xhprof/6507a35d72e9598700e37208c482329594fd3b41.patch b/testing/php7-xhprof/6507a35d72e9598700e37208c482329594fd3b41.patch
new file mode 100644
index 0000000000..d79ea0ee0d
--- /dev/null
+++ b/testing/php7-xhprof/6507a35d72e9598700e37208c482329594fd3b41.patch
@@ -0,0 +1,48 @@
+From 6507a35d72e9598700e37208c482329594fd3b41 Mon Sep 17 00:00:00 2001
+From: longxinhui <longxinhui.e@gmail.com>
+Date: Tue, 7 Aug 2018 11:24:33 +0800
+Subject: [PATCH] Fix memory leaks
+
+#15
+---
+ extension/php_xhprof.h | 2 +-
+ extension/xhprof.c | 6 +++++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/extension/php_xhprof.h b/extension/php_xhprof.h
+index 717c56a..bce4e81 100644
+--- a/extension/php_xhprof.h
++++ b/extension/php_xhprof.h
+@@ -142,7 +142,7 @@ do { \
+ #define INDEX_2_BYTE(index) (index >> 3)
+ #define INDEX_2_BIT(index) (1 << (index & 0x7));
+
+-#define register_trace_callback(function_name, cb) zend_hash_str_update(XHPROF_G(trace_callbacks), function_name, sizeof(function_name) - 1, &cb);
++#define register_trace_callback(function_name, cb) zend_hash_str_update_mem(XHPROF_G(trace_callbacks), function_name, sizeof(function_name) - 1, &cb, sizeof(hp_trace_callback));
+
+ /* XHProf maintains a stack of entries being profiled. The memory for the entry
+ * is passed by the layer that invokes BEGIN_PROFILING(), e.g. the hp_execute()
+diff --git a/extension/xhprof.c b/extension/xhprof.c
+index c1ecff1..b41768f 100644
+--- a/extension/xhprof.c
++++ b/extension/xhprof.c
+@@ -1633,6 +1633,10 @@ char *hp_get_trace_callback(char* symbol, zend_execute_data *data)
+ return result;
+ }
+
++static inline void hp_free_trace_callbacks(zval *val) {
++ efree(Z_PTR_P(val));
++}
++
+ void hp_init_trace_callbacks()
+ {
+ hp_trace_callback callback;
+@@ -1648,7 +1652,7 @@ void hp_init_trace_callbacks()
+ return;
+ }
+
+- zend_hash_init(XHPROF_G(trace_callbacks), 16, NULL, NULL, 0);
++ zend_hash_init(XHPROF_G(trace_callbacks), 8, NULL, hp_free_trace_callbacks, 0);
+
+ callback = hp_trace_callback_sql_query;
+ register_trace_callback("PDO::exec", callback);
diff --git a/testing/php7-xhprof/APKBUILD b/testing/php7-xhprof/APKBUILD
index 0ecbbe0f71..84c9d493fb 100644
--- a/testing/php7-xhprof/APKBUILD
+++ b/testing/php7-xhprof/APKBUILD
@@ -4,7 +4,7 @@
pkgname=php7-xhprof
_pkgreal=xhprof
pkgver=2.0.2
-pkgrel=0
+pkgrel=1
pkgdesc="A Hierarchical Profiler for PHP"
url="https://github.com/longxinH/xhprof"
arch="all"
@@ -12,7 +12,8 @@ license="Apache-2.0"
depends="php7 php7-ctype"
makedepends="php7-dev autoconf"
subpackages="$pkgname-assets::noarch"
-source="$pkgname-$pkgver.tar.gz::https://github.com/longxinH/xhprof/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/longxinH/xhprof/archive/v$pkgver.tar.gz
+ 6507a35d72e9598700e37208c482329594fd3b41.patch"
builddir="$srcdir/$_pkgreal-$pkgver"
build() {
@@ -51,4 +52,5 @@ assets() {
cp -R "$builddir"/examples "$installdir"
}
-sha512sums="6a3ea7994e7d23852d5265371bf59bfa41a3aab2e107b0293b8945adbbda78302ba827f95a54e0780582f06d9487d6e1894ecc2daada20c2ae87fa952e3ffd08 php7-xhprof-2.0.2.tar.gz"
+sha512sums="6a3ea7994e7d23852d5265371bf59bfa41a3aab2e107b0293b8945adbbda78302ba827f95a54e0780582f06d9487d6e1894ecc2daada20c2ae87fa952e3ffd08 php7-xhprof-2.0.2.tar.gz
+25d87a560cb344b62ba66f2cd0ebec9d512311d9e5c22ff7ab59d70f90b8c9b3e4d1fad0fdbbd8aa28da89328defc3d713525a88f2a42b06c6bd305f57e651b7 6507a35d72e9598700e37208c482329594fd3b41.patch"