We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe9f7cd commit a7fa224Copy full SHA for a7fa224
1 file changed
ext/libxml/ruby_xml_writer.c
@@ -196,6 +196,7 @@ static VALUE rxml_writer_doc(VALUE klass)
196
{
197
xmlDocPtr doc;
198
rxml_writer_object* rwo;
199
+ VALUE output, result;
200
201
rwo = ALLOC(rxml_writer_object);
202
rwo->buffer = NULL;
@@ -207,9 +208,12 @@ static VALUE rxml_writer_doc(VALUE klass)
207
208
209
rxml_raise(xmlGetLastError());
210
}
- rwo->output = rxml_document_wrap(doc);
211
+ output = rxml_document_wrap(doc);
212
+ rwo->output = output;
213
- return rxml_writer_wrap(rwo);
214
+ result = rxml_writer_wrap(rwo);
215
+ RB_GC_GUARD(output);
216
+ return result;
217
218
219
/* ===== public instance methods ===== */
0 commit comments