Skip to contentSkip to conversation

staging: vt6656: iwctl_giwaplist() re warn: possible memory leak of 'qual'

PATCH New Malcolm Priestley 1 participant 1 message Nov 15, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: iwctl_giwaplist() re warn: possible memory leak of 'qual'

---
 drivers/staging/vt6656/iwctl.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/vt6656/iwctl.c +5 -1
index a914d20..08557fa 100644
@@ -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)
Signature · 1 line
1.7.10.4