jgorbe added a comment. 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? 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