summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2016-04-04 07:42:56 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2016-04-25 09:09:17 +0200
commit3312a0f70b1cb9d0e8b6bbaaf7028b90daf3fa9c (patch)
tree486ce03dedc9527a34869ec8a8c1765475b65e00
parent89b902789bad004e0db51862a34de6e4ef6ed425 (diff)
coverity: avoid dereference after null check
All decompress functions used after this check take into account that encoder->palette is not NULL. So, if we already detected that the palette is NULL, let's just return early. Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--common/lz.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/lz.c b/common/lz.c
index d1c4033..2589223 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -647,6 +647,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
if (!encoder->palette) {
encoder->usr->error(encoder->usr,
"a palette is missing (for bpp to rgb decoding)\n");
+ return;
}
switch (encoder->type) {
case LZ_IMAGE_TYPE_PLT1_BE: