From e924762fe0ca7edbbed6ac0491cec0f843a1e9f6 Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Sat, 7 Oct 2017 15:13:39 +0200 Subject: [PATCH] Fix CID 187193. --- gtests/net/packetdrill/sctp_packet.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gtests/net/packetdrill/sctp_packet.c b/gtests/net/packetdrill/sctp_packet.c index 144cad39..cba5fce9 100644 --- a/gtests/net/packetdrill/sctp_packet.c +++ b/gtests/net/packetdrill/sctp_packet.c @@ -1001,10 +1001,12 @@ sctp_heartbeat_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(), -- GitLab