coll/sm: fix minor memory leaks
port 4488.1.patch attached in #196 to master