|
From: <sv...@va...> - 2011-07-06 14:13:16
|
Author: tom
Date: 2011-07-06 15:08:24 +0100 (Wed, 06 Jul 2011)
New Revision: 11859
Log:
Don't allocate the XArray for the text version of the suppression
until after we've checked if the tool will allow the error to be
suppressed, or we will leak it if we do the early return.
Spotted by IBM's BEAM checker.
Modified:
trunk/coregrind/m_errormgr.c
Modified: trunk/coregrind/m_errormgr.c
===================================================================
--- trunk/coregrind/m_errormgr.c 2011-07-06 07:23:56 UTC (rev 11858)
+++ trunk/coregrind/m_errormgr.c 2011-07-06 14:08:24 UTC (rev 11859)
@@ -346,14 +346,6 @@
vg_assert(err);
- /* In XML mode, we also need to print the plain text version of the
- suppresion in a CDATA section. What that really means is, we
- need to generate the plaintext version both in XML and text
- mode. So generate it into TEXT. */
- text = VG_(newXA)( VG_(malloc), "errormgr.gen_suppression.1",
- VG_(free), sizeof(HChar) );
- vg_assert(text);
-
ec = VG_(get_error_where)(err);
vg_assert(ec);
@@ -364,6 +356,14 @@
return;
}
+ /* In XML mode, we also need to print the plain text version of the
+ suppresion in a CDATA section. What that really means is, we
+ need to generate the plaintext version both in XML and text
+ mode. So generate it into TEXT. */
+ text = VG_(newXA)( VG_(malloc), "errormgr.gen_suppression.1",
+ VG_(free), sizeof(HChar) );
+ vg_assert(text);
+
/* Ok. Generate the plain text version into TEXT. */
VG_(xaprintf)(text, "{\n");
VG_(xaprintf)(text, " <%s>\n", dummy_name);
|