summaryrefslogtreecommitdiff
path: root/usr.sbin/btrace/map.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-09 06:58:40 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-09 06:58:40 +0000
commit49051790774c4965fd2bbd90e74046a5ff4d60f0 (patch)
treecbc476e53aa825917bf520a54e2b543f2b419f2c /usr.sbin/btrace/map.c
parent0b9607c0debd97bc436a26593718c590265ba22f (diff)
Make sure all map operators work after calling clear() on a map.
Fix assertions found by jasper@ with AFL++. ok jasper@
Diffstat (limited to 'usr.sbin/btrace/map.c')
-rw-r--r--usr.sbin/btrace/map.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/usr.sbin/btrace/map.c b/usr.sbin/btrace/map.c
index 5624db68069..9ec0fa3b7d9 100644
--- a/usr.sbin/btrace/map.c
+++ b/usr.sbin/btrace/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.16 2021/09/01 08:06:49 mpi Exp $ */
+/* $OpenBSD: map.c,v 1.17 2021/09/09 06:58:39 mpi Exp $ */
/*
* Copyright (c) 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -84,9 +84,6 @@ map_clear(struct map *map)
{
struct mentry *mep;
- if (map == NULL)
- return;
-
while ((mep = RB_MIN(map, map)) != NULL) {
RB_REMOVE(map, map, mep);
free(mep);