On Wed, 8 Dec 2021 15:31:26 +0200 Yordan Karadzhov <y.karadz@xxxxxxxxx> wrote: > >> remove_start_hist: > >> - remove_hist(synth->instance, synth->start_event, start_hist); > >> + remove_hist(synth->instance, synth->start_event, synth->start_hist); > >> remove_synthetic: > >> - free(end_hist); > >> - free(start_hist); > >> tracefs_dynevent_destroy(synth->dyn_event, false); > > I just realized that on error, we do not free the synthetic event > > descriptor. So there is a memory leak. > > > > Do we need to free the synthetic event here? > > The event gets allocated with 'tracefs_synth_alloc()' and the user is responsible for calling 'tracefs_synth_free()' in > order to free the memory. > The fact that 'tracefs_synth_create()' may fail doesn't change this. Ah, you're correct. I was thinking that we allocated it here, but forgot we separated create and alloc. -- Steve