From: tb Date: Fri, 27 Sep 2024 13:13:14 +0000 (+0000) Subject: rsync: make blkhash_free() callable with NULL. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7eb67ff9a029ded5e7c98bba369a471c1bd0f5da;p=openbsd rsync: make blkhash_free() callable with NULL. It is in principle possible that blkhash_free() (which obviously frees a struct blktab, sigh) is called with NULL. This would lead to a crash. ok claudio --- diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c index 97a51a21e36..d1d9b19c31e 100644 --- a/usr.bin/rsync/blocks.c +++ b/usr.bin/rsync/blocks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blocks.c,v 1.26 2024/09/27 13:10:39 tb Exp $ */ +/* $OpenBSD: blocks.c,v 1.27 2024/09/27 13:13:14 tb Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -125,6 +125,8 @@ blkhash_set(struct blktab *p, const struct blkset *bset) void blkhash_free(struct blktab *p) { + if (p == NULL) + return; free(p->q); free(p->blks); free(p);