From patchwork Mon Jul 4 14:11:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 942232 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p64Ef635021630 for ; Mon, 4 Jul 2011 14:41:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753315Ab1GDOLv (ORCPT ); Mon, 4 Jul 2011 10:11:51 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:35331 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145Ab1GDOLt (ORCPT ); Mon, 4 Jul 2011 10:11:49 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id E167E19BB73; Mon, 4 Jul 2011 16:11:48 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00394-11; Mon, 4 Jul 2011 16:11:45 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 6C7CF19BB99; Mon, 4 Jul 2011 16:11:45 +0200 (CEST) From: Julia Lawall To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] drivers/media/video: add missing kfree Date: Mon, 4 Jul 2011 16:11:42 +0200 Message-Id: <1309788705-22278-2-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 04 Jul 2011 14:41:11 +0000 (UTC) From: Julia Lawall Free the recently allocated qcam in each case. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x; @@ kfree(x) @@ identifier r.x; expression E1!=0,E2,E3,E4; statement S; @@ ( if (<+...x...+>) S | if (...) { ... when != kfree(x) when != if (...) { ... kfree(x); ... } when != x = E3 * return E1; } ... when != x = E2 if (...) { ... when != x = E4 kfree(x); ... return ...; } ) // Signed-off-by: Julia Lawall --- drivers/media/video/bw-qcam.c | 1 + drivers/media/video/c-qcam.c | 1 + 2 files changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index c119350..0aad9cc 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -895,6 +895,7 @@ static struct qcam *qcam_init(struct parport *port) if (v4l2_device_register(NULL, v4l2_dev) < 0) { v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); + kfree(qcam); return NULL; } diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 24fc009..351b2db 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -752,6 +752,7 @@ static struct qcam *qcam_init(struct parport *port) if (v4l2_device_register(NULL, v4l2_dev) < 0) { v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); + kfree(qcam); return NULL; }