From aa65f89a8f9b31fdbabc0b754ec8076f743cf634 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 29 Mar 2019 17:04:31 -0700 Subject: [PATCH] HistogramCombineStochastic: fix free of uninit value previously if the mappings allocation failed histo_queue->queue would be uninitialized; split the conditionals Change-Id: I1b50b987e734393893dc8a83a3f314522ccd0c83 --- src/enc/histogram_enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/enc/histogram_enc.c b/src/enc/histogram_enc.c index 8ac6fa8e..d89b9852 100644 --- a/src/enc/histogram_enc.c +++ b/src/enc/histogram_enc.c @@ -929,9 +929,8 @@ static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo, } mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings)); - if (mappings == NULL || !HistoQueueInit(&histo_queue, kHistoQueueSize)) { - goto End; - } + if (mappings == NULL) return 0; + if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End; // Fill the initial mapping. for (j = 0, iter = 0; iter < image_histo->size; ++iter) { if (histograms[iter] == NULL) continue;