cs8900_initialize() cleanup
authorMatthias Kaehlcke <matthias@kaehlcke.net>
Thu, 21 Jan 2010 21:16:34 +0000 (22:16 +0100)
committerBen Warren <biggerbadderben@gmail.com>
Mon, 1 Feb 2010 06:34:33 +0000 (22:34 -0800)
cs8900_initialize(): remove unecessary calls to free() and fix memory leak

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
drivers/net/cs8900.c

index df360042be8d887b83d6eee98869026395d9741b..9424fb2bb69cc697ea0fb3ab1a1dc54f511d7aec 100644 (file)
@@ -308,14 +308,13 @@ int cs8900_initialize(u8 dev_num, int base_addr)
 
        dev = malloc(sizeof(*dev));
        if (!dev) {
-               free(dev);
                return 0;
        }
        memset(dev, 0, sizeof(*dev));
 
        priv = malloc(sizeof(*priv));
        if (!priv) {
-               free(priv);
+               free(dev);
                return 0;
        }
        memset(priv, 0, sizeof(*priv));