]> 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:10:30 +0000 (07:10 -0500)
commitda8a617dc9863b06f1e74ce1e82e8b460860d7b1
tree3047e218dc87aca3bd57279dc401fa391bccb954
parent6482ab5bea791fe94d6f0f6b617d28eb0256a36c
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