Commit 0dcc73fe authored by Tom Lane's avatar Tom Lane

Ensure xmlFree(NULL) is a no-op instead of a core dump. Per report from

Sergey Burladyan, there are at least some dank corners of libxml2 that
assume this behavior, even though their published documentation suggests
they shouldn't.

This is only really a live problem in 8.3, but the code is still there
for possible debugging use in HEAD, so patch both branches.
parent f371fda3
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.90 2009/06/09 22:00:57 petere Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.91 2009/06/10 03:44:35 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1293,7 +1293,9 @@ xml_repalloc(void *ptr, size_t size) ...@@ -1293,7 +1293,9 @@ xml_repalloc(void *ptr, size_t size)
static void static void
xml_pfree(void *ptr) xml_pfree(void *ptr)
{ {
pfree(ptr); /* At least some parts of libxml assume xmlFree(NULL) is allowed */
if (ptr)
pfree(ptr);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment