diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c index 263d4b67a986..b3b255a1d65b 100644 --- a/libiberty/objalloc.c +++ b/libiberty/objalloc.c @@ -178,6 +178,10 @@ objalloc_free (struct objalloc *o) { struct objalloc_chunk *l; + /* Handle a nullptr as being a no-op. */ + if (o == NULL) + return; + l = (struct objalloc_chunk *) o->chunks; while (l != NULL) {