debuggers.hg
changeset 6764:9ead08216805
Restore NULL checks before calling kfree().
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Sep 10 14:44:31 2005 +0000 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Sep 10 20:14:50 2005 +0000 1.3 @@ -48,7 +48,8 @@ static int blkback_remove(struct xenbus_ 1.4 unregister_xenbus_watch(&be->backend_watch); 1.5 if (be->blkif) 1.6 blkif_put(be->blkif); 1.7 - kfree(be->frontpath); 1.8 + if (be->frontpath) 1.9 + kfree(be->frontpath); 1.10 kfree(be); 1.11 return 0; 1.12 } 1.13 @@ -254,7 +255,8 @@ static int blkback_probe(struct xenbus_d 1.14 free_be: 1.15 if (be->backend_watch.node) 1.16 unregister_xenbus_watch(&be->backend_watch); 1.17 - kfree(frontend); 1.18 + if (frontend) 1.19 + kfree(frontend); 1.20 kfree(be); 1.21 return err; 1.22 }
2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Sat Sep 10 14:44:31 2005 +0000 2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Sat Sep 10 20:14:50 2005 +0000 2.3 @@ -608,7 +608,8 @@ static int talk_to_backend(struct xenbus 2.4 } 2.5 2.6 out: 2.7 - kfree(backend); 2.8 + if (backend) 2.9 + kfree(backend); 2.10 return err; 2.11 2.12 abort_transaction:
3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Sat Sep 10 14:44:31 2005 +0000 3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c Sat Sep 10 20:14:50 2005 +0000 3.3 @@ -52,7 +52,8 @@ static int blkback_remove(struct xenbus_ 3.4 unregister_xenbus_watch(&be->backend_watch); 3.5 if (be->blkif) 3.6 blkif_put(be->blkif); 3.7 - kfree(be->frontpath); 3.8 + if (be->frontpath) 3.9 + kfree(be->frontpath); 3.10 kfree(be); 3.11 return 0; 3.12 } 3.13 @@ -199,7 +200,8 @@ static int blkback_probe(struct xenbus_d 3.14 free_be: 3.15 if (be->backend_watch.node) 3.16 unregister_xenbus_watch(&be->backend_watch); 3.17 - kfree(frontend); 3.18 + if (frontend) 3.19 + kfree(frontend); 3.20 kfree(be); 3.21 return err; 3.22 }
4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Sat Sep 10 14:44:31 2005 +0000 4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Sat Sep 10 20:14:50 2005 +0000 4.3 @@ -160,8 +160,10 @@ static int __init make_loopback(int i) 4.4 return 0; 4.5 4.6 fail: 4.7 - kfree(dev1); 4.8 - kfree(dev2); 4.9 + if (dev1 != NULL) 4.10 + kfree(dev1); 4.11 + if (dev2 != NULL) 4.12 + kfree(dev2); 4.13 return err; 4.14 } 4.15
5.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Sep 10 14:44:31 2005 +0000 5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Sep 10 20:14:50 2005 +0000 5.3 @@ -50,7 +50,8 @@ static int netback_remove(struct xenbus_ 5.4 unregister_xenbus_watch(&be->backend_watch); 5.5 if (be->netif) 5.6 netif_disconnect(be->netif); 5.7 - kfree(be->frontpath); 5.8 + if (be->frontpath) 5.9 + kfree(be->frontpath); 5.10 kfree(be); 5.11 return 0; 5.12 } 5.13 @@ -269,7 +270,8 @@ static int netback_probe(struct xenbus_d 5.14 free_be: 5.15 if (be->backend_watch.node) 5.16 unregister_xenbus_watch(&be->backend_watch); 5.17 - kfree(frontend); 5.18 + if (frontend) 5.19 + kfree(frontend); 5.20 kfree(be); 5.21 return err; 5.22 }
6.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Sat Sep 10 14:44:31 2005 +0000 6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Sat Sep 10 20:14:50 2005 +0000 6.3 @@ -1232,7 +1232,8 @@ static int talk_to_backend(struct xenbus 6.4 netif_state = NETIF_STATE_CONNECTED; 6.5 6.6 out: 6.7 - kfree(backend); 6.8 + if (backend) 6.9 + kfree(backend); 6.10 return err; 6.11 6.12 abort_transaction:
7.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Sat Sep 10 14:44:31 2005 +0000 7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Sat Sep 10 20:14:50 2005 +0000 7.3 @@ -148,7 +148,9 @@ static void inline 7.4 packet_free(struct packet *pak) 7.5 { 7.6 del_singleshot_timer_sync(&pak->processing_timer); 7.7 - kfree(pak->data_buffer); 7.8 + if (pak->data_buffer) { 7.9 + kfree(pak->data_buffer); 7.10 + } 7.11 /* 7.12 * cannot do tpmif_put(pak->tpmif); bad things happen 7.13 * on the last tpmif_put()
8.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Sep 10 14:44:31 2005 +0000 8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Sep 10 20:14:50 2005 +0000 8.3 @@ -52,7 +52,8 @@ static int tpmback_remove(struct xenbus_ 8.4 tpmif_put(be->tpmif); 8.5 } 8.6 8.7 - kfree(be->frontpath); 8.8 + if (be->frontpath) 8.9 + kfree(be->frontpath); 8.10 kfree(be); 8.11 return 0; 8.12 } 8.13 @@ -242,7 +243,8 @@ static int tpmback_probe(struct xenbus_d 8.14 free_be: 8.15 if (be->backend_watch.node) 8.16 unregister_xenbus_watch(&be->backend_watch); 8.17 - kfree(frontend); 8.18 + if (frontend) 8.19 + kfree(frontend); 8.20 kfree(be); 8.21 return err; 8.22 }
9.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Sat Sep 10 14:44:31 2005 +0000 9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Sat Sep 10 20:14:50 2005 +0000 9.3 @@ -363,7 +363,8 @@ static int talk_to_backend(struct xenbus 9.4 } 9.5 9.6 out: 9.7 - kfree(backend); 9.8 + if (backend) 9.9 + kfree(backend); 9.10 return err; 9.11 9.12 abort_transaction:
10.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c Sat Sep 10 14:44:31 2005 +0000 10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c Sat Sep 10 20:14:50 2005 +0000 10.3 @@ -781,7 +781,8 @@ static void dispatch_usb_io(usbif_priv_t 10.4 return; 10.5 10.6 no_mem: 10.7 - kfree(setup); 10.8 + if ( setup != NULL ) 10.9 + kfree(setup); 10.10 make_response(up, req->id, req->operation, -ENOMEM, 0, 0); 10.11 return; 10.12 }
11.1 --- a/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c Sat Sep 10 14:44:31 2005 +0000 11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c Sat Sep 10 20:14:50 2005 +0000 11.3 @@ -1720,7 +1720,8 @@ static int __init xhci_hcd_init(void) 11.4 return 0; 11.5 11.6 up_failed: 11.7 - kfree(errbuf); 11.8 + if (errbuf) 11.9 + kfree(errbuf); 11.10 11.11 errbuf_failed: 11.12 return retval;