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
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 6f06f6c..a2d1db0 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc
@@ -4407,6 +4407,9 @@ } } } else { + if (bits == 0) { + goto err1; + } // get color space and color map dict->lookup("ColorSpace", &obj1); @@ -4479,10 +4482,6 @@ obj1.free(); dict->lookup("D", &obj1); } - if (bits == 0) { - delete colorSpace; - goto err2; - } colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); if (!colorMap->isOk()) {