]> 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 11:41:02 +0000 (06:41 -0500)
commit46fb9fb663102c742266c2d165d82f17cd69df73
treece1df06f53eb8c067d1921d8a5f55065e1db4e7d
parentdd739f8a08ea32671b3ecc2400ccc9a2b4554cc2
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