From 0931029a168d81709b9e5f9eec10cc255bbc489c Mon Sep 17 00:00:00 2001 From: otto Date: Sun, 13 Feb 2022 20:02:30 +0000 Subject: [PATCH] Handle the case in freechunks where not a single allocation has happened. ok deraadt@ --- lib/libpcap/gencode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index 1a642167e38..d15f17403d5 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.59 2021/12/05 16:40:24 deraadt Exp $ */ +/* $OpenBSD: gencode.c,v 1.60 2022/02/13 20:02:30 otto Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -205,6 +205,8 @@ freechunks(void) int i, j; for (i = 0; i <= cur_membag; i++) { + if (membag[i].ptrs == NULL) + continue; for (j = 0; j <= membag[i].slot; j++) free(membag[i].ptrs[j]); free(membag[i].ptrs); -- 2.20.1