Em Mon, 3 Aug 2009 08:30:12 +0200 Jean-Francois Moine <moinejf@xxxxxxx> escreveu: > On Sun, 2 Aug 2009 17:25:29 +0400 > Alexey Klimov <klimov.linux@xxxxxxxxx> wrote: > > > > + buffer = kmalloc(JEILINJ_MAX_TRANSFER, GFP_KERNEL | > > > GFP_DMA); > > > + if (!buffer) { > > > + PDEBUG(D_ERR, "Couldn't allocate USB buffer"); > > > + goto quit_stream; > > > + } > > > > This clean up on error path looks bad. On quit_stream you have: > > > > > +quit_stream: > > > + mutex_lock(&gspca_dev->usb_lock); > > > + if (gspca_dev->present) > > > + jlj_stop(gspca_dev); > > > + mutex_unlock(&gspca_dev->usb_lock); > > > + kfree(buffer); > > > > kfree() tries to free null buffer after kmalloc for buffer failed. > > Please, check if i'm not wrong. > > Hi Alexey, > > AFAIK, kfree() checks the pointer. Yeah. Theodore's code is ok. kfree(NULL) is legal. > > Cheers. > Cheers, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html