From b44cad6598b4e0eeaa3b5c54f157a69d3d8cd87e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 20 May 2020 18:24:55 -0700 Subject: [PATCH] Fix freeing uninitialized pointer on allocation failure --- src/RtpFecQueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RtpFecQueue.c b/src/RtpFecQueue.c index 14c8e64..fe073b0 100644 --- a/src/RtpFecQueue.c +++ b/src/RtpFecQueue.c @@ -126,8 +126,8 @@ static int reconstructFrame(PRTP_FEC_QUEUE queue) { } reed_solomon* rs = NULL; - unsigned char** packets = malloc(totalPackets * sizeof(unsigned char*)); - unsigned char* marks = malloc(totalPackets * sizeof(unsigned char)); + unsigned char** packets = calloc(totalPackets, sizeof(unsigned char*)); + unsigned char* marks = calloc(totalPackets, sizeof(unsigned char)); if (packets == NULL || marks == NULL) { ret = -2; goto cleanup;