diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-09-16 00:49:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-09-16 00:49:49 +0000 |
commit | 015f168f546afbcf1bbd77b3a2200f484993fe26 (patch) | |
tree | 5154831c81ea9cc80aea498337bd95e17d560e76 /src | |
parent | e4aea74e1924195d73c79dd68fb88eb7914dbd77 (diff) |
Fix multiple memory leaks in xml_out(). Per report from Matt Magoffin.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/adt/xml.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 7a627b7683b..c5b5e87abca 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.68.2.3 2008/07/03 00:04:34 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.68.2.4 2008/09/16 00:49:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -208,7 +208,6 @@ xml_out_internal(xmltype *x, pg_enc target_encoding) #ifdef USE_LIBXML xmlChar *version; - xmlChar *encoding; int standalone; int res_code; #endif @@ -220,7 +219,7 @@ xml_out_internal(xmltype *x, pg_enc target_encoding) #ifdef USE_LIBXML if ((res_code = parse_xml_decl((xmlChar *) str, - &len, &version, &encoding, &standalone)) == 0) + &len, &version, NULL, &standalone)) == 0) { StringInfoData buf; @@ -238,6 +237,10 @@ xml_out_internal(xmltype *x, pg_enc target_encoding) } appendStringInfoString(&buf, str + len); + if (version) + xmlFree(version); + pfree(str); + return buf.data; } |