[libbacktrace] Don't point to released memory in backtrace_vector_release
authorTom de Vries <tdevries@suse.de>
Tue, 27 Nov 2018 08:26:04 +0000 (08:26 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 27 Nov 2018 08:26:04 +0000 (08:26 +0000)
commit6d760a0197ece131619ac88f0fe34ce452fd774c
tree766ea0b74a27945cf9a88eabcf6775774905a7d5
parent0c155f24a945a55c37a963f64e89870f60543e64
[libbacktrace] Don't point to released memory in backtrace_vector_release

When backtrace_vector_release is called with vec.size == 0, it releases the
memory pointed at by vec.base.

Set vec.base set to NULL if vec.size == 0 to ensure we don't point to released
memory.

Bootstrapped and reg-tested on x86_64.

2018-11-27  Tom de Vries  <tdevries@suse.de>

* mmap.c (backtrace_vector_release): Same.
* unittest.c (test1): Add check.

From-SVN: r266505
libbacktrace/ChangeLog
libbacktrace/mmap.c
libbacktrace/unittest.c