The current implementation of Mapping::getInverse allocates a new AstMapping, but does not free it if AST's internal error flag triggers an exception via assertOK.
In addition, Object::fromAstObject does not free rawObjCopy if there is a dynamic casting error.
The leaks in these methods should be fixed using either assertOK or a catch or finally block. Unfortunately, as I understand it astshim's object and type juggling would interfere with using a unique_ptr.
In addition, both methods should document the exceptions they throw and their (intended) exception safety.