ucimap: fix use-after-free on cleanup (patch by Stanislav Fomichev)