staging: vt6656: iwctl_giwaplist() re warn: possible memory leak of 'qual'
authorMalcolm Priestley <tvboxspy@gmail.com>
Thu, 15 Nov 2012 16:57:29 +0000 (16:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Nov 2012 23:26:14 +0000 (15:26 -0800)
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/iwctl.c

index a914d20cc0ea00d3f111a3cb1779e07c0cc8a76c..08557fa9f0074aa0d964d2eb1bed8b75d244fa76 100644 (file)
@@ -655,9 +655,13 @@ int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
                return -EINVAL;
 
        sock = kzalloc(sizeof(struct sockaddr) * IW_MAX_AP, GFP_KERNEL);
+       if (sock == NULL)
+               return -ENOMEM;
        qual = kzalloc(sizeof(struct iw_quality) * IW_MAX_AP, GFP_KERNEL);
-       if (sock == NULL || qual == NULL)
+       if (qual == NULL) {
+               kfree(sock);
                return -ENOMEM;
+       }
 
        for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
                if (!pBSS[ii].bActive)