On Mon, 04 Sep 2023 16:08:15 +0200, Takashi Iwai wrote: > > On Sun, 03 Sep 2023 21:42:55 +0200, > Christophe JAILLET wrote: > > > > Le 03/09/2023 à 18:37, Takashi Iwai a écrit : > > > On Sun, 03 Sep 2023 17:04:47 +0200, > > ... > > For the start_input_streams() caller, this is fine, because the > > corresponding memory is kzalloc()'ed in start_input_streams() at some > > point, but I've not been able to check for snd_usb_midi_v2_open(). Oh I overlooked that point. Yes, it's a missing call, although the memory leaks as free_midi_urbs() is called also at the destructor, free_midi2_endpoint(), too. But it's definitely better to call at the error path, too. Will fix it up together and submit the proper fix patch. thanks, Takashi > > > > CJ > > > > > > > > --- a/sound/usb/midi2.c > > > +++ b/sound/usb/midi2.c > > > @@ -265,7 +265,7 @@ static void free_midi_urbs(struct snd_usb_midi2_endpoint *ep) > > > if (!ep) > > > return; > > > - for (i = 0; i < ep->num_urbs; ++i) { > > > + for (i = 0; i < NUM_URBS; ++i) { > > > ctx = &ep->urbs[i]; > > > if (!ctx->urb) > > > break; > > > > > > That was the intended behavior of free_midi_urbs(). > > > > > > > > > Takashi > > > > > >