Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: chrome/common/libxml_utils.cc

Issue 63001: Fix XMLWriter crash (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/libxml_utils.h" 5 #include "chrome/common/libxml_utils.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
11 #include "libxml/xmlreader.h" 11 #include "libxml/xmlreader.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 continue; 113 continue;
114 } 114 }
115 } while (Read()); 115 } while (Read());
116 return false; 116 return false;
117 } 117 }
118 118
119 119
120 // XmlWriter functions 120 // XmlWriter functions
121 121
122 XmlWriter::XmlWriter() : 122 XmlWriter::XmlWriter() :
123 writer_(NULL) {} 123 writer_(NULL),
124 buffer_(NULL) {}
124 125
125 XmlWriter::~XmlWriter() { 126 XmlWriter::~XmlWriter() {
126 if (writer_) 127 if (writer_)
127 xmlFreeTextWriter(writer_); 128 xmlFreeTextWriter(writer_);
128 if (buffer_) 129 if (buffer_)
129 xmlBufferFree(buffer_); 130 xmlBufferFree(buffer_);
130 } 131 }
131 132
132 void XmlWriter::StartWriting() { 133 void XmlWriter::StartWriting() {
133 buffer_ = xmlBufferCreate(); 134 buffer_ = xmlBufferCreate();
134 writer_ = xmlNewTextWriterMemory(buffer_, 0); 135 writer_ = xmlNewTextWriterMemory(buffer_, 0);
135 xmlTextWriterSetIndent(writer_, 1); 136 xmlTextWriterSetIndent(writer_, 1);
136 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL); 137 xmlTextWriterStartDocument(writer_, NULL, NULL, NULL);
137 } 138 }
138 139
139 void XmlWriter::StopWriting() { 140 void XmlWriter::StopWriting() {
140 xmlTextWriterEndDocument(writer_); 141 xmlTextWriterEndDocument(writer_);
141 xmlFreeTextWriter(writer_); 142 xmlFreeTextWriter(writer_);
142 writer_ = NULL; 143 writer_ = NULL;
143 } 144 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698