diff --git a/pcbnew/python/swig/pcbnew.i b/pcbnew/python/swig/pcbnew.i index dbedfb9a6b..a3f56483ac 100644 --- a/pcbnew/python/swig/pcbnew.i +++ b/pcbnew/python/swig/pcbnew.i @@ -94,6 +94,11 @@ wxArrayString GetFootprints(const wxString& aNickName); %} +// Tell SWIG that the caller owns the PCB_IO* returned by FindPlugin and is +// responsible for deleting it. This fixes memory leaks in Python wrapper +// functions like FootprintLoad that call GetPluginForPath -> FindPlugin. +%newobject PCB_IO_MGR::FindPlugin; + %include %include