summaryrefslogtreecommitdiff
path: root/xmlwriter.c
diff options
context:
space:
mode:
Diffstat (limited to 'xmlwriter.c')
-rw-r--r--xmlwriter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xmlwriter.c b/xmlwriter.c
index f618610..7acae76 100644
--- a/xmlwriter.c
+++ b/xmlwriter.c
@@ -545,7 +545,9 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version,
writer->out->encoder = encoder;
if (encoder != NULL) {
- writer->out->conv = xmlBufferCreateSize(4000);
+ if (writer->out->conv == NULL) {
+ writer->out->conv = xmlBufferCreateSize(4000);
+ }
xmlCharEncOutFunc(encoder, writer->out->conv, NULL);
if ((writer->doc != NULL) && (writer->doc->encoding == NULL))
writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name);