On Sun, Oct 23, 2022 at 02:17:58PM +0300, Eli Zaretskii wrote: > So here's the error message I get when Perl crashes: > > Free to wrong pool 3f5d70 not 50d0190 at > ..\..\tp/Texinfo/XS/parsetexi/Parsetexi.pm line 97. > > This hints on a memory allocation problem. And indeed, Parsetexi.pm > line 97 does this: > > reset_parser (); > > And reset_parser calls a bunch of functions from indices.c, which use > malloc/realloc/free without redirecting them to the Perl allocation > functions. I guess we need the dTXH thingy there, but doing so needs > some Perl includes? Can you tell me what I need to put at the > beginning of the file to be able to use dTHX safely in indices.c? > > Or maybe we need something other than dTHX there? > > I see that a lot of other files in tp/Texinfo/XS/parsetexi/ call > memory allocation functions, but don't have dTHX -- is that safe?
I believe the issue is with calling 'free' inside api.c itself. It should be okay inside the other files. We don't include the Perl header files everywhere - only in api.c. We need to move this code to other files and this should fix the problem.