File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 77 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88 * Portions Copyright (c) 1994, Regents of the University of California
99 *
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 $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -208,22 +208,16 @@ xml_in(PG_FUNCTION_ARGS)
208208static char *
209209xml_out_internal (xmltype * x , pg_enc target_encoding )
210210{
211- char * str ;
212- size_t len ;
211+ char * str = text_to_cstring ((text * ) x );
213212
214213#ifdef USE_LIBXML
214+ size_t len = strlen (str );
215215 xmlChar * version ;
216- xmlChar * encoding ;
217216 int standalone ;
218217 int res_code ;
219- #endif
220-
221- str = text_to_cstring ((text * ) x );
222- len = strlen (str );
223218
224- #ifdef USE_LIBXML
225219 if ((res_code = parse_xml_decl ((xmlChar * ) str ,
226- & len , & version , & encoding , & standalone )) == 0 )
220+ & len , & version , NULL , & standalone )) == 0 )
227221 {
228222 StringInfoData buf ;
229223
@@ -241,6 +235,10 @@ xml_out_internal(xmltype *x, pg_enc target_encoding)
241235 }
242236 appendStringInfoString (& buf , str + len );
243237
238+ if (version )
239+ xmlFree (version );
240+ pfree (str );
241+
244242 return buf .data ;
245243 }
246244
You can’t perform that action at this time.
0 commit comments