From patchwork Fri Jan 17 16:38:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masanari Iida X-Patchwork-Id: 3506261 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EE7E89F2E9 for ; Fri, 17 Jan 2014 16:38:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0342B20142 for ; Fri, 17 Jan 2014 16:38:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3AE4920131 for ; Fri, 17 Jan 2014 16:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752415AbaAQQiL (ORCPT ); Fri, 17 Jan 2014 11:38:11 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:46204 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752144AbaAQQiK (ORCPT ); Fri, 17 Jan 2014 11:38:10 -0500 Received: by mail-pd0-f175.google.com with SMTP id r10so4195245pdi.34 for ; Fri, 17 Jan 2014 08:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vy+AMbqgKfN0L1RbNRSd2s9VzfnWWvUQ7lY+otCwljQ=; b=zmas3o+/V0OSWD3GnJl4OFUsCUCF2ND7EBOYjXzwp4503m7zvCZmcd0hLRlA0kLpEw l3uswvxBrZg7xzBBqMlLe76paDyiD+FBy04lDb3Nvn5wlT2OENqUggQ46z5oSuug2CXs ZnnEkt6rb5sLFvKufDung83ybHo4xxTqH18FJuR2CHm1DGqrxA2CqnTueXbwFc8awArR 9E5MuJ0uneyJz2V4EtZTP+W/OVf9Jl8d5bKv5/Fgz0SfgdRB6dUNcYOEcdCCohdSiaoT nPjFVXwaBXO23SJeLe/+DyuJN0YAeXjVnMCiuw3VXRTsJnbLHeQxaopLlCz58APzwIbY cmPQ== X-Received: by 10.68.239.230 with SMTP id vv6mr3202329pbc.34.1389976689274; Fri, 17 Jan 2014 08:38:09 -0800 (PST) Received: from masabert (i118-21-156-233.s30.a048.ap.plala.or.jp. [118.21.156.233]) by mx.google.com with ESMTPSA id qq5sm24020592pbb.24.2014.01.17.08.38.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jan 2014 08:38:08 -0800 (PST) Received: by masabert (Postfix, from userid 1000) id AA860646D2; Sat, 18 Jan 2014 01:38:04 +0900 (JST) From: Masanari Iida To: m.chehab@samsung.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, hverkuil@xs4all.nl Cc: Masanari Iida Subject: [PATCH] [media] hdpvr: Fix memory leak in debug Date: Sat, 18 Jan 2014 01:38:00 +0900 Message-Id: <1389976680-21269-1-git-send-email-standby24x7@gmail.com> X-Mailer: git-send-email 1.8.5.2.309.ga25014b Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP cppcheck reported memory leak in device_authorizatio() within hdpvr-core.c. When the debug option is specified and the code jump to "unlock:" label, print_buf was not freed. Confirm the module succesfully compiled without error. Signed-off-by: Masanari Iida --- drivers/media/usb/hdpvr/hdpvr-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index 2f0c89c..c563896 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -198,7 +198,6 @@ static int device_authorization(struct hdpvr_device *dev) hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0); v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n", print_buf); - kfree(print_buf); #endif msleep(100); @@ -214,6 +213,9 @@ static int device_authorization(struct hdpvr_device *dev) retval = ret != 8; unlock: mutex_unlock(&dev->usbc_mutex); +#ifdef HDPVR_DEBUG + kfree(print_buf); +#endif return retval; }