Use shash_destroy_free_data() to simplify a few scattered pieces of code.