wl1251: fix a memory leak in probe
[safe/jmp/linux-2.6] / net / netlabel / netlabel_kapi.c
index cae2f5f..1b83e00 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <linux/init.h>
 #include <linux/types.h>
+#include <linux/slab.h>
 #include <linux/audit.h>
 #include <linux/in.h>
 #include <linux/in6.h>
@@ -151,7 +152,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
                        addr6 = addr;
                        mask6 = mask;
                        map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
-                       if (map4 == NULL)
+                       if (map6 == NULL)
                                goto cfg_unlbl_map_add_failure;
                        map6->type = NETLBL_NLTYPE_UNLABELED;
                        ipv6_addr_copy(&map6->list.addr, addr6);
@@ -185,8 +186,7 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
        return 0;
 
 cfg_unlbl_map_add_failure:
-       if (entry != NULL)
-               kfree(entry->domain);
+       kfree(entry->domain);
        kfree(entry);
        kfree(addrmap);
        kfree(map4);
@@ -385,8 +385,7 @@ int netlbl_cfg_cipsov4_map_add(u32 doi,
 
 cfg_cipsov4_map_add_failure:
        cipso_v4_doi_putdef(doi_def);
-       if (entry != NULL)
-               kfree(entry->domain);
+       kfree(entry->domain);
        kfree(entry);
        kfree(addrmap);
        kfree(addrinfo);
@@ -861,6 +860,19 @@ req_setattr_return:
 }
 
 /**
+* netlbl_req_delattr - Delete all the NetLabel labels on a socket
+* @req: the socket
+*
+* Description:
+* Remove all the NetLabel labeling from @req.
+*
+*/
+void netlbl_req_delattr(struct request_sock *req)
+{
+       cipso_v4_req_delattr(req);
+}
+
+/**
  * netlbl_skbuff_setattr - Label a packet using the correct protocol
  * @skb: the packet
  * @family: protocol family