Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1248263ybl; Sat, 17 Aug 2019 23:01:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8BwM0oLeOXdUM+rTXRxDXGIJKB05Lmi4QG0D6TlD9vpdzuiTNqApW72cHpuHfuvoRzHNA X-Received: by 2002:a63:a35c:: with SMTP id v28mr14759204pgn.144.1566108063009; Sat, 17 Aug 2019 23:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566108063; cv=none; d=google.com; s=arc-20160816; b=lx+C343CPfJDzmT5sqczErl7egewTUlR3AwUHVpiM4ZqnLVSO54Rgv3VdlqEgAhK/9 xMXJkhRTyWrj+MY2t6d7oOAzhQ+raPDNEmL1Y9qJYMdiH36si1S1kEHaKQwz4JqSXKEy we3JJQ7MZBvHw/Q4wvogZEgXPF+7EqKs1/Kruqw2dz2/I7iZHqR0a+1crqm6XC4aFKGX VcgzdzT65l073qG/r72zJD6FmPS1LnRnso/8pC9Kw3beGZLJCgnP2VGRahflFaO7eHxc OR/DY11xUQytlLfJwUEqUFmGFkH3muCgXRQGEXs59nGizBoB5b1UTjjcLfcn2igSd66o t+zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=z+ekumFDBeqsCJJqP+DBppfAA/PTmlYsOJRcevKwZrQ=; b=i8BI2Qilpb+U/TFTtN9G0qduhqvIWmzkUQZMmZqZCnP99xsu1H7J1AALHAc7tG2fRT fmIbVjb54mPwtARQw31g/Y6mlFuNttJeGfO6EmZfBSEsyJbpv6dAnVdBo4loVeNJ2Ju5 pI7urF7R2MlEvDTz3i7JbzTylJwXnE7Af9IbOhGJNynwGxkhtDlh0HQrwB1vSHbgUFyh 7Gu104lcotvVHqnE0/E8kCwPJWiyLDf6kWYhtrnZT7qcvZMnRATLiS1UjhY+lOhji52W V6uSKpmhAEZyO7J+q+PprsHCN03BuP3Q23OnwE9dGJuKXiWfbvH72yftoAaGbhy4RXKa Tqbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y30si7284066pga.143.2019.08.17.23.00.39; Sat, 17 Aug 2019 23:01:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbfHRF7C (ORCPT + 99 others); Sun, 18 Aug 2019 01:59:02 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:36552 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725209AbfHRF7B (ORCPT ); Sun, 18 Aug 2019 01:59:01 -0400 Received: by mail-yb1-f195.google.com with SMTP id m9so3309345ybm.3; Sat, 17 Aug 2019 22:59:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=z+ekumFDBeqsCJJqP+DBppfAA/PTmlYsOJRcevKwZrQ=; b=O1UseAXtW+CWVrhgMit6lPXYcN1akvaslFvKv4X0n7OCIRZuPUNzgBeUe5/HBJexPc Ue76TLKIS48F1Fve2OSZH9d0qLVvVYBMgBAef+0Zq1JKj/e4ksy/iB9hI8X4z1LwNZro OmPauFUhcZv7EAZfXoY23a7Ww0PcPRV9VN/fh/U0rxmYmTttayJMo0lF419bh7WJZ45/ 15xHjLrY+X9YmWxO2dienkmiNCcd4o7IZyvdSA/bTgoF62ZbFWaIv8J3a0mSWeMylQNV Ry/3PH1OppYrMIbzABIDt/LI13MJ+d0DQdzCMREVonD9OdQ8N6oM8zVfaRo9vqylSYhR SV3Q== X-Gm-Message-State: APjAAAVaov8upEGug+GtnRwyZjMxxUzX3CTL1SzGVLBrznxba1vf84yi 1c4wFWydLEImloom64zn9Ls= X-Received: by 2002:a25:8b01:: with SMTP id i1mr13474480ybl.478.1566107940804; Sat, 17 Aug 2019 22:59:00 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id d15sm568385ywa.34.2019.08.17.22.58.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 17 Aug 2019 22:59:00 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Kieran Bingham , Mauro Carvalho Chehab , linux-media@vger.kernel.org (open list:MEDIA DRIVERS FOR RENESAS - FDP1), linux-renesas-soc@vger.kernel.org (open list:MEDIA DRIVERS FOR RENESAS - FDP1), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] media: fdp1: Fix a memory leak bug Date: Sun, 18 Aug 2019 00:58:53 -0500 Message-Id: <1566107933-3355-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In fdp1_open(), 'ctx' is allocated through kzalloc(). However, it is not deallocated if v4l2_ctrl_new_std() fails, leading to a memory leak bug. To fix this issue, free 'ctx' before going to the 'done' label. Signed-off-by: Wenwen Wang --- drivers/media/platform/rcar_fdp1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c index 43aae9b..9e4b330 100644 --- a/drivers/media/platform/rcar_fdp1.c +++ b/drivers/media/platform/rcar_fdp1.c @@ -2122,6 +2122,7 @@ static int fdp1_open(struct file *file) if (ctx->hdl.error) { ret = ctx->hdl.error; v4l2_ctrl_handler_free(&ctx->hdl); + kfree(ctx); goto done; } -- 2.7.4