[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] alloc_netdev must be freed with free_netdev, not directly by kfree.



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 011d6df7697987007205ff59e6d14de41cd47702
# Parent  bea58b594c4af6b34ce65e6db290884eb5bb463a
alloc_netdev must be freed with free_netdev, not directly by kfree.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r bea58b594c4a -r 011d6df76979 
linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Mon Feb 20 
16:49:35 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Mon Feb 20 
17:06:36 2006
@@ -137,10 +137,13 @@
 
        sprintf(dev_name, "vif0.%d", i);
        dev1 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
+       if (!dev1)
+               return err;
+
        sprintf(dev_name, "veth%d", i);
        dev2 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
-       if ((dev1 == NULL) || (dev2 == NULL))
-               goto fail;
+       if (!dev2)
+               goto fail_netdev2;
 
        loopback_construct(dev1, dev2);
        loopback_construct(dev2, dev1);
@@ -169,8 +172,9 @@
        return 0;
 
  fail:
-       kfree(dev1);
-       kfree(dev2);
+       free_netdev(dev2);
+ fail_netdev2:
+       free_netdev(dev1);
        return err;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.