umat: fix memory leaks
Merge pull request #1997 from alalek:tapi_fix_memleaks