diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-06-10 03:44:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-06-10 03:44:35 +0000 |
commit | 0dcc73fea4a3371272465f418d323dbd45f9faff (patch) | |
tree | 5ff70f90a84b4f5914ab482f813fdd39248d618b /src/backend/utils/adt/xml.c | |
parent | f371fda397c68bf15e091862a76a24795e42462a (diff) | |
download | postgresql-0dcc73fea4a3371272465f418d323dbd45f9faff.tar.gz postgresql-0dcc73fea4a3371272465f418d323dbd45f9faff.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/xml.c')
-rw-r--r-- | src/backend/utils/adt/xml.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index fca92e867d0..18f209489ea 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * 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) static void xml_pfree(void *ptr) { - pfree(ptr); + /* At least some parts of libxml assume xmlFree(NULL) is allowed */ + if (ptr) + pfree(ptr); } |