]> git.ipfire.org Git - thirdparty/asterisk.git/commit
vector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors
authorSean Bright <sean.bright@gmail.com>
Tue, 4 Aug 2020 15:51:16 +0000 (11:51 -0400)
committerJoshua Colp <jcolp@sangoma.com>
Mon, 10 Aug 2020 12:02:40 +0000 (07:02 -0500)
commitabad3950989a2d2f4ceb3b8f6b65f2822ad3405e
tree6f84db992e95f937d468017de9eaa009e0781f7c
parent1e58da7814d169fb5e6acf098b5566226c0dacba
vector.h: Fix implementation of AST_VECTOR_COMPACT() for empty vectors

The assumed behavior of realloc() - that it was effectively a free() if
its second argument was 0 - is Linux specific behavior and is not
guaranteed by either POSIX or the C specification.

Instead, if we want to resize a vector to 0, do it explicitly.

Change-Id: Ife31d4b510ebab41cb5477fdc7ea4e3138ca8b4f
include/asterisk/vector.h