]> 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:21:52 +0000 (07:21 -0500)
commit048b12b59dec84b3ac6c8bd16ef4f9b47bcefebd
tree184971c7b541a5dba48188ff26e7f73f5a9e94cc
parente8c2ce2873faefe4292f4760230cbbc6e3e00219
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