libsystemd-network: dhcp-test - assert that malloc0 succeeds

Otherwise we would get a nullptr dereference later on.

Found by coverity. Fixes CID #1237655.
This commit is contained in:
Tom Gundersen 2014-09-17 19:07:56 +02:00
parent f414a269b3
commit 6f42877282

View file

@ -115,6 +115,7 @@ static DHCPMessage *create_message(uint8_t *options, uint16_t optlen,
size_t len = sizeof(DHCPMessage) + optlen;
message = malloc0(len);
assert_se(message);
if (options && optlen)
memcpy(&message->options, options, optlen);