Fix NULL pointer dereference in solv_chksum_free()
Commit
a4f1b2fc ("Split the checksum implementation into chksum_impl.c")
introduced a NULL pointer dereference in solv_chksum_free(). The
refactoring added an else branch that accesses chk->impl to free
internal resources, but this branch is reached even when chk is NULL.
Before the refactoring, solv_chksum_free(NULL, NULL) was safe:
- the "if (cp)" branch was skipped (cp is NULL)
- solv_free(NULL) was called, which is a no-op
After the refactoring:
- the "if (cp)" branch is skipped
- the new "else if (chk->impl)" dereferences chk, which is NULL
Fix by adding a NULL check for chk at the top of solv_chksum_free(),
restoring the pre-refactoring behavior.
Signed-off-by: Marek Blaha <mblaha@redhat.com>