Gitlab has been upgraded to v13.9 🎉. Enjoy

Commit 74f21b9d authored by Andy Postnikov's avatar Andy Postnikov

testing/php7-xhprof: fix s390x build

parent fcbda8f8
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);
......@@ -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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment