summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-12-31 15:54:20 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2014-12-31 15:55:10 +0100
commit889cec8d58a00c8362ab0c6493bad39e9c6849bc (patch)
tree69cb9370a289dc24ac82844bb04ccb6a05cbd05f /src/libsystemd-network
parent06a079055a68dd73150ed002fad7059ad3b41235 (diff)
network: add malloc-assertion in test
Make sure malloc() really returns non-NULL in lldp test.
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r--src/libsystemd-network/test-lldp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c
index e9d5d7bb60..288aac5961 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);