libmid: fix CID 84881 + doc + cleanup