Download raw body.
fix null deref under GOT_OBJ_CACHE_DEBUG
On Wed, Aug 31, 2022 at 09:59:00AM +0200, Omar Polo wrote: > cache->idset can be NULL as I just discovered. This is more for > nitpicking' sake rather than anything, but it avoids a crash when > debugging the object cache and hitting the limits. Sure, ok. > diff /home/op/w/got > commit - 98275f2eefb932aee3f1824f53c268fd736f6c5f > path + /home/op/w/got > blob - 9a73324894a8116700bddcfd4f59c9a3a39dd2e5 > file + lib/object_cache.c > --- lib/object_cache.c > +++ lib/object_cache.c > @@ -294,7 +294,7 @@ print_cache_stats(struct got_object_cache *cache, cons > { > fprintf(stderr, "%s: %s cache: %d elements, %d searches, %d hits, " > "%d missed, %d evicted, %d too large\n", getprogname(), name, > - got_object_idset_num_elements(cache->idset), > + cache->idset ? got_object_idset_num_elements(cache->idset) : -1, > cache->cache_searches, cache->cache_hit, > cache->cache_miss, cache->cache_evict, cache->cache_toolarge); > } > @@ -378,7 +378,8 @@ got_object_cache_close(struct got_object_cache *cache) > break; > } > > - got_object_idset_for_each(cache->idset, check_refcount, cache); > + if (cache->idset) > + got_object_idset_for_each(cache->idset, check_refcount, cache); > #endif > > if (cache->idset) { > >
fix null deref under GOT_OBJ_CACHE_DEBUG