From bcabc8095d80312e5fcc817372cf97ae51b55cbd Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Wed, 12 Nov 2008 00:27:59 -0200 Subject: ttusb_dec: Add NULL pointer validation From: Douglas Schilling Landgraf Added validation for NULL pointer Priority: high Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c') diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 5c2885e17..9259cfe54 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1166,6 +1166,12 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) ISO_BUF_COUNT), &dec->iso_dma_handle); + if (!dec->iso_buffer) { + dprintk("%s: pci_alloc_consistent - not enough memory\n", + __func__); + return -ENOMEM; + } + memset(dec->iso_buffer, 0, ISO_FRAME_SIZE * (FRAMES_PER_ISO_BUF * ISO_BUF_COUNT)); -- cgit v1.2.3 From cc6988d1d04471ba46cd740cca95c3fddfefc7bf Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Wed, 12 Nov 2008 00:47:57 -0200 Subject: ttusb_dec: fix memory leak From: Douglas Schilling Landgraf Free allocated memory Priority: high Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c') diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 9259cfe54..7cfc2e4d0 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1269,6 +1269,7 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec) dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE, GFP_ATOMIC, &dec->irq_dma_handle); if(!dec->irq_buffer) { + usb_free_urb(dec->irq_urb); return -ENOMEM; } usb_fill_int_urb(dec->irq_urb, dec->udev,dec->irq_pipe, -- cgit v1.2.3