File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.76 2008/08/25 22:42:34 tgl Exp $
10
+ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.77 2008/09/16 00:49:41 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -208,22 +208,16 @@ xml_in(PG_FUNCTION_ARGS)
208
208
static char *
209
209
xml_out_internal (xmltype * x , pg_enc target_encoding )
210
210
{
211
- char * str ;
212
- size_t len ;
211
+ char * str = text_to_cstring ((text * ) x );
213
212
214
213
#ifdef USE_LIBXML
214
+ size_t len = strlen (str );
215
215
xmlChar * version ;
216
- xmlChar * encoding ;
217
216
int standalone ;
218
217
int res_code ;
219
- #endif
220
-
221
- str = text_to_cstring ((text * ) x );
222
- len = strlen (str );
223
218
224
- #ifdef USE_LIBXML
225
219
if ((res_code = parse_xml_decl ((xmlChar * ) str ,
226
- & len , & version , & encoding , & standalone )) == 0 )
220
+ & len , & version , NULL , & standalone )) == 0 )
227
221
{
228
222
StringInfoData buf ;
229
223
@@ -241,6 +235,10 @@ xml_out_internal(xmltype *x, pg_enc target_encoding)
241
235
}
242
236
appendStringInfoString (& buf , str + len );
243
237
238
+ if (version )
239
+ xmlFree (version );
240
+ pfree (str );
241
+
244
242
return buf .data ;
245
243
}
246
244
You can’t perform that action at this time.
0 commit comments