]> git.ipfire.org Git - thirdparty/libsolv.git/commit
Fix NULL pointer dereference in solv_chksum_free() 623/head
authorMarek Blaha <mblaha@redhat.com>
Thu, 28 May 2026 08:59:01 +0000 (08:59 +0000)
committerMarek Blaha <mblaha@redhat.com>
Thu, 28 May 2026 09:00:26 +0000 (11:00 +0200)
commit107f91c5d2d9af668c6267cd89c581a9dfc9d540
tree75838dff802dde4992b05735243c1fafbee74590
parent2cba95a19e870f441d7539e4711fd6a51d2b1c19
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>
src/chksum.c