This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix double free in python bindings error handling.
ClosedPublic

Authored by jgorbe on Mar 27 2023, 3:14 PM.

Details

Summary

If we have a %typemap(freearg) that frees the argument, we shouldn't
free it manually on an error path before calling SWIG_fail.
SWIG_fail will already free the memory in this case, and doing it
manually results in a double free.

Diff Detail

Event Timeline

jgorbe created this revision.Mar 27 2023, 3:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2023, 3:14 PM
bulbazord accepted this revision.Mar 27 2023, 3:16 PM

Thanks for taking care of that!

This revision is now accepted and ready to land.Mar 27 2023, 3:16 PM
JDevlieghere accepted this revision.Mar 27 2023, 3:27 PM

LGTM. I think it would be worth adding that information to the top of the file to prevent similar mistakes in the future.

This revision was automatically updated to reflect the committed changes.

LGTM. I think it would be worth adding that information to the top of the file to prevent similar mistakes in the future.

Good idea, thanks. I added a note at the top before committing.

mib added a comment.Mar 27 2023, 4:29 PM

LGTM! Thanks @jgorbe !