test_packet_id: Add a check after malloc to ensure value is valid

cppcheck complains about a potential null pointer dereference
in reliable_get_num_output_sequenced_available. That is mostly
theoretical, but still add a check.

Change-Id: I64da2328591ef2b9ee7502e574c878651cdf356a
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1621
Message-Id: <20260406074729.29903-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36516.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Frank Lichtenheld 2026-04-06 09:47:24 +02:00 committed by Gert Doering
parent 08a19843a1
commit cdb0fbde26

View file

@ -164,6 +164,7 @@ static void
test_get_num_output_sequenced_available(void **state)
{
struct reliable *rel = malloc(sizeof(struct reliable));
assert_non_null(rel);
reliable_init(rel, 100, 50, 8, false);
rel->array[5].active = true;