diff --git a/gtests/net/packetdrill/sctp_packet.c b/gtests/net/packetdrill/sctp_packet.c index 2652f968bf7ae186b6afbb0bb2e25fc74c6bafb0..0cc6e4ab5b02bba855ab6b86038700dbe233841b 100644 --- a/gtests/net/packetdrill/sctp_packet.c +++ b/gtests/net/packetdrill/sctp_packet.c @@ -1048,10 +1048,12 @@ sctp_heartbeat_ack_chunk_new(s64 flgs, struct sctp_parameter_list_item *info) chunk->flags = (u8)flgs; } chunk->length = htons(chunk_length); - memcpy(chunk->value, info->parameter, info->length); - memset(chunk->value + info->length, 0, padding_length); - free(info->parameter); - free(info); + if (info != NULL) { + memcpy(chunk->value, info->parameter, info->length); + memset(chunk->value + info->length, 0, padding_length); + free(info->parameter); + free(info); + } return sctp_chunk_list_item_new((struct sctp_chunk *)chunk, chunk_length + padding_length, flags, sctp_parameter_list_new(),