From f50ad180fe1508009e848fcefeda3b55562b4fcd Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 21 Oct 2015 12:06:08 +0200 Subject: [PATCH] fix leak with strings! --- src/module.c | 12 ++++++++++++ tests/idn/idn003.phpt | 24 ++++++++++++++++++++++++ tests/idn/idn004.phpt | 30 ++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 tests/idn/idn003.phpt create mode 100644 tests/idn/idn004.phpt diff --git a/src/module.c b/src/module.c index dba74c5..4e7f4ce 100644 --- a/src/module.c +++ b/src/module.c @@ -289,6 +289,18 @@ void psi_do_clean(impl *impl) { size_t i; + for (i = 0; i < impl->func->args->count; ++i ) { + impl_arg *iarg = impl->func->args->args[i]; + + switch (iarg->type->type) { + case PSI_T_STRING: + if (iarg->val.str) { + zend_string_release(iarg->val.str); + } + break; + } + } + for (i = 0; i < impl->decl->args->count; ++i) { decl_arg *darg = impl->decl->args->args[i]; diff --git a/tests/idn/idn003.phpt b/tests/idn/idn003.phpt new file mode 100644 index 0000000..8befdc9 --- /dev/null +++ b/tests/idn/idn003.phpt @@ -0,0 +1,24 @@ +--TEST-- +libidn +--INI-- +psi.directory={PWD} +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECT-- +===TEST=== +xn--bcher-kva.de +Success +===DONE=== \ No newline at end of file diff --git a/tests/idn/idn004.phpt b/tests/idn/idn004.phpt new file mode 100644 index 0000000..d70f307 --- /dev/null +++ b/tests/idn/idn004.phpt @@ -0,0 +1,30 @@ +--TEST-- +libidn +--INI-- +psi.directory={PWD} +--SKIPIF-- + +--FILE-- +===TEST=== + +===DONE=== +--EXPECT-- +===TEST=== +xn--bcher-kva.de +Success +xn--bcher2-3ya.de +Success +===DONE=== \ No newline at end of file -- 2.30.2