[WATCHDOG] pcwd_usb.c: fix a NULL pointer dereference
authorAdrian Bunk <bunk@stusta.de>
Fri, 10 Mar 2006 18:04:38 +0000 (19:04 +0100)
committerWim Van Sebroeck <wim@iguana.be>
Sun, 2 Apr 2006 16:51:50 +0000 (18:51 +0200)
The Coverity checker noted that this resulted in a NULL pointer
reference if we were coming from

        if (usb_pcwd == NULL) {
                printk(KERN_ERR PFX "Out of memory\n");
                    goto error;
        }

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@osdl.org>
drivers/char/watchdog/pcwd_usb.c

index 2700c5c..3fdfda9 100644 (file)
@@ -705,7 +705,8 @@ err_out_misc_deregister:
 err_out_unregister_reboot:
        unregister_reboot_notifier(&usb_pcwd_notifier);
 error:
-       usb_pcwd_delete (usb_pcwd);
+       if (usb_pcwd)
+               usb_pcwd_delete(usb_pcwd);
        usb_pcwd_device = NULL;
        return retval;
 }