[alsa-devel] [PATCH 11/15] ALSA: line6: Only free buffer if it is set.
Andrej Krutak
dev at andree.sk
Thu Aug 11 21:02:23 CEST 2016
This makes the resource freeing not dependent on the existence of private data
from the podhd module, which may be gone during the call.
Signed-off-by: Andrej Krutak <dev at andree.sk>
---
sound/usb/line6/driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 344465f..142e0e3 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -479,13 +479,14 @@ static void line6_destruct(struct snd_card *card)
struct usb_device *usbdev = line6->usbdev;
/* free buffer memory first: */
- if (line6->properties->capabilities & LINE6_CAP_CONTROL_MIDI)
+ if (line6->buffer_message)
kfree(line6->buffer_message);
kfree(line6->buffer_listen);
/* then free URBs: */
usb_free_urb(line6->urb_listen);
+ line6->urb_listen = NULL;
/* decrement reference counters: */
usb_put_dev(usbdev);
--
1.9.1
More information about the Alsa-devel
mailing list