bulbazord added a comment. In D146590#4220388 <https://reviews.llvm.org/D146590#4220388>, @jgorbe wrote:
> I found the actual reason for the crash I was talking about. This patch only > addressed the incorrect `OverflowError`, but the crash comes from a double > free (as @rupprecht mentioned) in the error handling logic. The error path > here > <https://github.com/llvm/llvm-project/blob/main/lldb/bindings/python/python-typemaps.swig#L298> > does both `free($1);` and `SWIG_fail;`. The same goes for another error > check a few lines below that. In the generated code, the `SWIG_fail` macro is > expanded to `goto fail` and the `fail` label also frees the same memory > buffer. > > I believe (but I don't have any experience with SWIG typemaps so this is an > educated guess) that the call to `free` in the error path comes from the > `%typemap(freearg)` immediately after that one. So if freearg already takes > care of it, the error handling logic in `%typemap(in)` should just call > `SWIG_fail`. Does that sound correct? Yea, after reading the SWIG documentation, this diagnosis looks correct. If you'd like to fix this feel free to upload a patch and list myself and @mib as reviewers. Otherwise let me know and I can take care of it. Thanks for doing that investigation! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146590/new/ https://reviews.llvm.org/D146590 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits