From cdab9a2dc27a10c84550db28fac8dbdcdcd4d29d Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 5 May 2017 00:47:45 +0200 Subject: Move the bits sanity checking a bit higher in the function Saves some time and makes the code simpler as we have to delete one thing less --- poppler/Gfx.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 6f06f6ca..a2d1db0c 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -4407,6 +4407,9 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } } } else { + if (bits == 0) { + goto err1; + } // get color space and color map dict->lookup("ColorSpace", &obj1); @@ -4479,10 +4482,6 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); dict->lookup("D", &obj1); } - if (bits == 0) { - delete colorSpace; - goto err2; - } colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); if (!colorMap->isOk()) { -- cgit v1.2.3