[libbacktrace] Avoid realloc with size == 0 in backtrace_vector_release
authorTom de Vries <tdevries@suse.de>
Tue, 27 Nov 2018 08:25:52 +0000 (08:25 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 27 Nov 2018 08:25:52 +0000 (08:25 +0000)
commit0c155f24a945a55c37a963f64e89870f60543e64
tree5936c40993d7b836b78772d3d1b6d97cd1055148
parent1ea7ea181d8d3139df4ea66dc2ee98b27fa66b6f
[libbacktrace] Avoid realloc with size == 0 in backtrace_vector_release

As of C17, realloc with size 0 is marked as an obsolescent feature.

Fix this in backtrace_vector_release by using free instead.

Bootstrapped and reg-tested on x86_64.

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

* alloc.c (backtrace_vector_release): Handle vec->size == 0 using free
instead of realloc.
* Makefile.am (check_PROGRAMS): Add unittest.
* Makefile.in: Regenerate.
* unittest.c: New file.

From-SVN: r266504
libbacktrace/ChangeLog
libbacktrace/Makefile.am
libbacktrace/Makefile.in
libbacktrace/alloc.c
libbacktrace/unittest.c [new file with mode: 0644]