From 889cec8d58a00c8362ab0c6493bad39e9c6849bc Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 31 Dec 2014 15:54:20 +0100 Subject: [PATCH] network: add malloc-assertion in test Make sure malloc() really returns non-NULL in lldp test. --- src/libsystemd-network/test-lldp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c index e9d5d7bb60e..288aac5961f 100644 --- a/src/libsystemd-network/test-lldp.c +++ b/src/libsystemd-network/test-lldp.c @@ -144,6 +144,7 @@ static int lldp_parse_port_id_tlv(tlv_packet *m) { assert_se(tlv_packet_read_string(m, &str, &length) >= 0); p = malloc0(length + 1); + assert_se(p); strncpy(p, str, length-1); assert_se(streq(p, TEST_LLDP_PORT) == 1); @@ -182,6 +183,7 @@ static int lldp_parse_system_desc_tlv(tlv_packet *m) { assert_se(tlv_packet_read_string(m, &str, &length) >= 0); p = malloc0(length + 1); + assert_se(p); strncpy(p, str, length); assert_se(streq(p, TEST_LLDP_TYPE_SYSTEM_DESC) == 1);