avoid memory leak in modrepo