[php-src] master: iconv: Fix memory management in autoconf test for `//IGNORE` (#22620)

Tim Düsterhus via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Tim Düsterhus (TimWolla)
Committer: GitHub (web-flow)
Pusher: TimWolla
Date: 2026-07-06T22:46:38+02:00

Commit: https://github.com/php/php-src/commit/d6be30e3252fa6a52ed03f666745ace7b4c717ac
Raw diff: https://github.com/php/php-src/commit/d6be30e3252fa6a52ed03f666745ace7b4c717ac.diff

iconv: Fix memory management in autoconf test for `//IGNORE` (#22620)

Sometimes running `./configure` for ASAN hangs on my machine. This is
reproducible when compiling and running the program manually using

    clang-16 -g -fsanitize=undefined,address test.c

It seems this is related to the LLVM symbolizer getting stuck, and the
symbolizer is likely required to report the memory leak. After adding the
memory management functions it seems to work (or rather fail) reliably.

Changed paths:
  M  ext/iconv/config.m4


Diff:

diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
index e86f3535a97c..bea97b27f4f7 100644
--- a/ext/iconv/config.m4
+++ b/ext/iconv/config.m4
@@ -112,6 +112,8 @@ int main(void) {
   char *out = malloc(out_left);
   char *out_p = out;
   size_t result = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);
+  free(out);
+  iconv_close(cd);
   if(result == (size_t)-1) {
     return 1;
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.