Fix YAML string leak in custom_template helper