diff options
| author | Mark Wielaard <[email protected]> | 2015-11-19 12:37:08 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-11-27 14:41:51 +0100 |
| commit | e2cf85cd35d33f92ff3d032e941783238a8fdaa1 (patch) | |
| tree | 2fc8359d80c6bc74e1d27f19af08325a60017650 /libdw/frame-cache.c | |
| parent | b47fb2366f2ac3015d7cf9ae3938392196609831 (diff) | |
libdw: Make sure Ebl is always freed from cfi frame cache.
libdwfl sets the Dwfl_Module Ebl for the eh_cfi and dwarf_cfi cache to
save a bit of memory. It also calls ebl_closebackend on the ebl to free
it. The Dwarf_CFI never frees the Ebl in the cache, even when it opened
one itself. This means that if only libdw calls are used to access the
Dwarf_CFI the Ebl might be leaked.
Always destroy the Dwarf_CFI cache Ebl in __libdw_destroy_frame_cache.
And in __libdwfl_module_free clear the Dwarf_CFI Ebl if it is the
Dwfl_Module Ebl before calling dwarf_cfi_end and dwarf_end.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/frame-cache.c')
| -rw-r--r-- | libdw/frame-cache.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libdw/frame-cache.c b/libdw/frame-cache.c index 54a1cc9a..5b6afb5d 100644 --- a/libdw/frame-cache.c +++ b/libdw/frame-cache.c @@ -1,5 +1,5 @@ /* Frame cache handling. - Copyright (C) 2009 Red Hat, Inc. + Copyright (C) 2009, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ # include <config.h> #endif +#include "../libebl/libebl.h" #include "cfi.h" #include <search.h> #include <stdlib.h> @@ -63,4 +64,7 @@ __libdw_destroy_frame_cache (Dwarf_CFI *cache) tdestroy (cache->fde_tree, free_fde); tdestroy (cache->cie_tree, free_cie); tdestroy (cache->expr_tree, free_expr); + + if (cache->ebl != NULL && cache->ebl != (void *) -1l) + ebl_closebackend (cache->ebl); } |
