From ad6aa00be0b654d1f7ad7fe52392f2fdaf7edfa0 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Sat, 27 Jan 2018 14:14:46 +0000 Subject: [PATCH] =?utf8?q?request.c:=20zero=20realloc=E2=80=99d=20memory?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For some reason this was being found by Valgrind on Travis, but not on my dev machine. --- src/request.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/request.c b/src/request.c index 02c3493..fede25a 100644 --- a/src/request.c +++ b/src/request.c @@ -218,6 +218,8 @@ add_to_sequence (RECODE_REQUEST request, RECODE_SINGLE single, if ((unsigned)request->sequence_length == request->sequence_allocated) { + unsigned old_allocated = request->sequence_allocated; + if (request->sequence_allocated == 0) request->sequence_allocated = 16; else @@ -229,6 +231,9 @@ add_to_sequence (RECODE_REQUEST request, RECODE_SINGLE single, recode_error (outer, _("Virtual memory exhausted!")); return false; } + + memset (request->sequence_array + old_allocated, 0, + (request->sequence_allocated - old_allocated) * sizeof (struct recode_step)); } step = request->sequence_array + request->sequence_length++; -- 2.50.0