Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0dcc73f

Browse files
committed
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.
1 parent f371fda commit 0dcc73f

File tree

1 file changed

+4
-2
lines changed
  • src/backend/utils/adt

1 file changed

+4
-2
lines changed

src/backend/utils/adt/xml.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, 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.90 2009/06/09 22:00:57 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.91 2009/06/10 03:44:35 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1293,7 +1293,9 @@ xml_repalloc(void *ptr, size_t size)
12931293
static void
12941294
xml_pfree(void *ptr)
12951295
{
1296-
pfree(ptr);
1296+
/* At least some parts of libxml assume xmlFree(NULL) is allowed */
1297+
if (ptr)
1298+
pfree(ptr);
12971299
}
12981300

12991301

0 commit comments

Comments
 (0)