added missing frees()