Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/elftoolchain/dist/libdwarf Delay freeing the di...



details:   https://anonhg.NetBSD.org/src/rev/d14b1ea4abc0
branches:  trunk
changeset: 814603:d14b1ea4abc0
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 31 15:53:33 2016 +0000

description:
Delay freeing the die where the indirect attribute is found. Found by jemalloc
J, see: https://mail-index.netbsd.org/current-users/2016/03/28/msg029130.html

diffstat:

 external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 6719921aaa11 -r d14b1ea4abc0 external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c
--- a/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c   Thu Mar 31 15:06:39 2016 +0000
+++ b/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c   Thu Mar 31 15:53:33 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwarf_attrval.c,v 1.7 2016/03/18 14:58:18 christos Exp $       */
+/*     $NetBSD: dwarf_attrval.c,v 1.8 2016/03/31 15:53:33 christos Exp $       */
 
 /*-
  * Copyright (c) 2007 John Birrell (jb%freebsd.org@localhost)
@@ -28,7 +28,7 @@
 
 #include "_libdwarf.h"
 
-__RCSID("$NetBSD: dwarf_attrval.c,v 1.7 2016/03/18 14:58:18 christos Exp $");
+__RCSID("$NetBSD: dwarf_attrval.c,v 1.8 2016/03/31 15:53:33 christos Exp $");
 ELFTC_VCSID("Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste ");
 
 int
@@ -146,14 +146,11 @@
     Dwarf_Unsigned val)
 {
        Dwarf_Die die1;
-       Dwarf_Attribute at;
 
        if ((die1 = _dwarf_die_find(die, val)) == NULL)
                return NULL;
 
-       at = _dwarf_attr_find(die1, attr);
-       dwarf_dealloc(dbg, die1, DW_DLA_DIE);
-       return at;
+       return _dwarf_attr_find(die1, attr);
 }
 
 int
@@ -213,9 +210,13 @@
                *valp = at->u[0].u64;
                break;
        default:
+               if (at->at_die != die)
+                       dwarf_dealloc(dbg, at->at_die, DW_DLA_DIE);
                DWARF_SET_ERROR(dbg, err, DW_DLE_ATTR_FORM_BAD);
                return (DW_DLV_ERROR);
        }
 
+       if (at->at_die != die)
+               dwarf_dealloc(dbg, at->at_die, DW_DLA_DIE);
        return (DW_DLV_OK);
 }



Home | Main Index | Thread Index | Old Index