From: Malcolm Priestley Date: Thu, 15 Nov 2012 16:57:29 +0000 (+0000) Subject: staging: vt6656: iwctl_giwaplist() re warn: possible memory leak of 'qual' X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2a38e6fcf9173ffa8acf827c0b5d69863e012434;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: vt6656: iwctl_giwaplist() re warn: possible memory leak of 'qual' Signed-off-by: Malcolm Priestley Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index a914d20cc0ea..08557fa9f007 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -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)