]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix leak of range_list (see below an example) in readdwarf3.c.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 6 Mar 2012 20:35:20 +0000 (20:35 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 6 Mar 2012 20:35:20 +0000 (20:35 +0000)
(found by running regression tests with an outer memcheck).

(validated by running all regression tests "natively" on x86 and amd64,
and re-running regressions tests with outer memcheck).

==7500== 160 bytes in 2 blocks are definitely lost in loss record 75 of 246
==7500==    at 0x2803CEF7: vgPlain_arena_malloc (m_mallocfree.c:1599)
==7500==    by 0x280AAFA5: vgModuleLocal_dinfo_zalloc (misc.c:48)
==7500==    by 0x2804E2A4: vgPlain_newXA (m_xarray.c:68)
==7500==    by 0x280B3CD6: unitary_range_list (readdwarf3.c:703)
==7500==    by 0x280B66CF: parse_var_DIE (readdwarf3.c:1631)
==7500==    by 0x280BA0A6: read_DIE (readdwarf3.c:3248)
==7500==    by 0x280BA170: read_DIE (readdwarf3.c:3269)
==7500==    by 0x280BABC4: T.364 (readdwarf3.c:3611)
==7500==    by 0x280BC634: vgModuleLocal_new_dwarf3_reader (readdwarf3.c:4035)
==7500==    by 0x280609F4: vgModuleLocal_read_elf_debug_info (readelf.c:2529)
==7500==    by 0x2805BD31: vgPlain_di_notify_mmap (debuginfo.c:610)
==7500==    by 0x280362E3: valgrind_main (m_main.c:1944)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12419

coregrind/m_debuginfo/readdwarf3.c

index 705c1f5fc2361e10f98c963fe822af57a5f2fe5d..bb90ef6d383001ee7f3c2671aa4facec43e99b38 100644 (file)
@@ -3644,9 +3644,6 @@ void new_dwarf3_reader_wrk (
          cu_amount_used = cu_offset_now - cc.cu_start_offset;
       }
 
-      if (cu_offset_now == debug_info_sz)
-         break;
-
       /* Preen to level -2.  DIEs have level >= 0 so -2 cannot occur
          anywhere else at all.  Our fake the-entire-address-space
          range is at level -1, so preening to -2 should completely
@@ -3655,6 +3652,9 @@ void new_dwarf3_reader_wrk (
       varstack_preen( &varparser, td3, -2 );
       /* Similarly, empty the type stack out. */
       typestack_preen( &typarser, td3, -2 );
+
+      if (cu_offset_now == debug_info_sz)
+         break;
       /* else keep going */
 
       TRACE_D3("set_abbv_Cursor cache: %lu queries, %lu misses\n",