glz_enc_dictionary_restore: return NULL upon failure

glz_enc_dictionary_create may return NULL.
glz_enc_dictionary_restore itself may return NULL so
add one more check.

Found-by: gcc (10) analyzer

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Uri Lublin 2020-05-17 17:55:02 +03:00 committed by Frediano Ziglio
parent 954eabaeb7
commit 031ab732dd

View File

@ -197,6 +197,9 @@ GlzEncDictContext *glz_enc_dictionary_restore(GlzEncDictRestoreData *restore_dat
}
SharedDictionary *ret = (SharedDictionary *)glz_enc_dictionary_create(
restore_data->size, restore_data->max_encoders, usr);
if (!ret) {
return NULL;
}
ret->last_image_id = restore_data->last_image_id;
return ((GlzEncDictContext *)ret);
}