On Thu, 24 Aug 2023 14:19:06 -0600 Ross Zwisler <zwisler@xxxxxxxxxx> wrote: > > +int traceeval_iterator_remove(struct traceeval_iterator *iter) > > +{ > > + struct traceeval *teval = iter->teval; > > + struct hash_table *hist = teval->hist; > > + struct entry *entry; > > + > > + if (iter->next < 1 || iter->next > iter->nr_entries) > > + return 0; > > + > > + entry = iter->entries[iter->next - 1]; > > + if (!entry) > > + return 0; > > + > > + hash_remove(hist, &entry->hash); > > Are we leaking 'entry' after we've removed it from the hash? Yeah, I guess we are. Good catch! > > I think we need to call free_entry() in both traceeval_iterator_remove() as > well as traceeval_remove(), just like we do in the loop in > hist_table_release(). Yep, thanks Ross! -- Steve > > > + > > + /* The entry no longer exists */ > > + iter->entries[iter->next - 1] = NULL; > > + teval->update_counter++; > > + > > + return 1; > > } > > -- > > 2.40.1 > >