|
From: <sv...@va...> - 2012-03-12 22:07:05
|
philippe 2012-03-12 22:06:57 +0000 (Mon, 12 Mar 2012)
New Revision: 12442
Log:
Fix leak in debuginfo.c
di->soname was not freed, so was leaked when debug info is removed.
free(soname) added in free_Debuginfo, after having verified
and then ensured that all soname are allocated in dinfo.
regtested on deb6/amd64
Modified files:
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/readelf.c
Modified: trunk/coregrind/m_debuginfo/readelf.c (+1 -1)
===================================================================
--- trunk/coregrind/m_debuginfo/readelf.c 2012-03-11 22:24:03 +00:00 (rev 12441)
+++ trunk/coregrind/m_debuginfo/readelf.c 2012-03-12 22:06:57 +00:00 (rev 12442)
@@ -1605,7 +1605,7 @@
find a soname, add a fake one. */
if (di->soname == NULL) {
TRACE_SYMTAB("No soname found; using (fake) \"NONE\"\n");
- di->soname = "NONE";
+ di->soname = ML_(dinfo_strdup)("di.redi.2", "NONE");
}
vg_assert(n_rx >= 0 && n_rx <= N_RX_RW_AREAS);
Modified: trunk/coregrind/m_debuginfo/debuginfo.c (+1 -0)
===================================================================
--- trunk/coregrind/m_debuginfo/debuginfo.c 2012-03-11 22:24:03 +00:00 (rev 12441)
+++ trunk/coregrind/m_debuginfo/debuginfo.c 2012-03-12 22:06:57 +00:00 (rev 12442)
@@ -205,6 +205,7 @@
vg_assert(di != NULL);
if (di->fsm.filename) ML_(dinfo_free)(di->fsm.filename);
+ if (di->soname) ML_(dinfo_free)(di->soname);
if (di->loctab) ML_(dinfo_free)(di->loctab);
if (di->cfsi) ML_(dinfo_free)(di->cfsi);
if (di->cfsi_exprs) VG_(deleteXA)(di->cfsi_exprs);
Modified: trunk/coregrind/m_debuginfo/priv_storage.h (+1 -2)
===================================================================
--- trunk/coregrind/m_debuginfo/priv_storage.h 2012-03-11 22:24:03 +00:00 (rev 12441)
+++ trunk/coregrind/m_debuginfo/priv_storage.h 2012-03-12 22:06:57 +00:00 (rev 12442)
@@ -515,8 +515,7 @@
we have committed to reading the symbols and debug info (that
is, at the point where .have_dinfo is set to True). */
- /* The file's soname. FIXME: ensure this is always allocated in
- VG_AR_DINFO. */
+ /* The file's soname. */
UChar* soname;
/* Description of some important mapped segments. The presence or
|