From patchwork Sat Aug 20 11:14:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Rankin X-Patchwork-Id: 270 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sat, 20 Aug 2011 11:14:50 +0000 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.20) for (single-drop); Sat, 20 Aug 2011 04:50:30 -0700 (PDT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QujVp-0007FB-TB; Sat, 20 Aug 2011 11:14:50 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752759Ab1HTLOo (ORCPT + 1 other); Sat, 20 Aug 2011 07:14:44 -0400 Received: from nm4.bt.bullet.mail.ukl.yahoo.com ([217.146.183.202]:37896 "HELO nm4.bt.bullet.mail.ukl.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752566Ab1HTLOo (ORCPT ); Sat, 20 Aug 2011 07:14:44 -0400 Received: from [217.146.183.196] by nm4.bt.bullet.mail.ukl.yahoo.com with NNFMP; 20 Aug 2011 11:14:42 -0000 Received: from [217.146.183.205] by tm2.bt.bullet.mail.ukl.yahoo.com with NNFMP; 20 Aug 2011 11:14:42 -0000 Received: from [127.0.0.1] by omp1003.bt.mail.ukl.yahoo.com with NNFMP; 20 Aug 2011 11:14:42 -0000 X-Yahoo-Newman-Id: 764547.20347.bm@omp1003.bt.mail.ukl.yahoo.com Received: (qmail 61105 invoked from network); 20 Aug 2011 11:14:42 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=DKIM-Signature:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=cta2SQXP72VLzbYpW9a9ix3z+/NPCajAYSrwk0ZaP1B3lT1Qo6g/JVgkDW2oJg04lXZJZfiu59ehS1xinBmkCsV7J1cfcbfvMQwtxWSnggX8hWdjCo00SMZY3OeowLVUdFlp619N/tr0CzjW88OZxItHiEXoGiriu7+81XxrDv0= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1313838882; bh=zU/ADt4+W9x/P2cnEed45twb4khe+eNkgDsooi992QU=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type; b=j4ivikEzQAt9V1uwKqpTSdgmmsoD0YJZaDzbYpXl9kwm94wyQvHrnQy/NUmQubgTbXZMCRzAgqwXLs0KRXXC9uq5UMen2c1aLTNLAQzHDn1G5OF4tbPP0RMN+irmITwIePd3wsdNjRrAKCVdo8ocv09ZlkNoKSRTMLvcYubyCuw= X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: dFfAYRkVM1nxvXzfRueY4SafgKBQRfC_sQ_7hblIU3FxyfJ L0xpYV.FMvXoKKUw7nj8drA1V.6PrrqFMvb62EQZVMDgrS.OLHgNsgE7V7MF rZWQXK62t9woj0b0ExzPUJeVvf2b.pIkzGePuuSRx6bEfhWG8gMKVSNcnssG qLzp1nszgNLeQFnO9Me2bth87NjE4ZyqiZTl8BcaFEQJWaW9IRwvgjp0piYK cmSM3WEBK9AC4dlaAk2.mP_B__Xh61dcjRk4KiptxZJbHU7rrQMLWj2zczqB TXZFRge3.2xrSejGP0ejdWm96TY.9hxxkRezNfLn1jfoaHuJGFAiWfgwPCRl QJMvAefesQsJPTiCrHYg301uKa63ILYcx6tqzaAjTBQwrRnW36uXAS3LaEeI X X-Yahoo-SMTP: dMK34oyswBBlfKesWTI5ovDjFOUFE6shtILt.ZXnUEjQHhWq Received: from wellhouse.underworld (rankincj@86.182.26.38 with login) by smtp819.mail.ukl.yahoo.com with SMTP; 20 Aug 2011 11:14:42 +0000 GMT Received: from volcano.underworld (volcano.underworld [192.168.0.3]) by wellhouse.underworld (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p7KBEdOU011427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 20 Aug 2011 12:14:41 +0100 Message-ID: <4E4F971F.5070902@yahoo.com> Date: Sat, 20 Aug 2011 12:14:39 +0100 From: Chris Rankin User-Agent: Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110707 Thunderbird/5.0 MIME-Version: 1.0 To: Mauro Carvalho Chehab CC: Devin Heitmueller , linux-media@vger.kernel.org, Antti Palosaari Subject: [PATCH 2/6] Fix memory leak on disconnect or error. References: <4E4D5157.2080406@yahoo.com> <4E4D8DFD.5060800@yahoo.com> <4E4DFA65.4090508@redhat.com> In-Reply-To: <4E4DFA65.4090508@redhat.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Release the dev->alt_max_pkt_size buffer in all cases. Signed-off-by: Chris Rankin --- linux-3.0/drivers/media/video/em28xx/em28xx-video.c.orig 2011-08-18 17:20:10.000000000 +0100 +++ linux-3.0/drivers/media/video/em28xx/em28xx-video.c 2011-08-18 17:20:33.000000000 +0100 @@ -2202,6 +2202,7 @@ free the remaining resources */ if (dev->state & DEV_DISCONNECTED) { em28xx_release_resources(dev); + kfree(dev->alt_max_pkt_size); kfree(dev); return 0; } --- linux-3.0/drivers/media/video/em28xx/em28xx-cards.c.orig 2011-08-17 08:52:19.000000000 +0100 +++ linux-3.0/drivers/media/video/em28xx/em28xx-cards.c 2011-08-18 22:09:32.000000000 +0100 @@ -3128,6 +3128,7 @@ retval = em28xx_init_dev(&dev, udev, interface, nr); if (retval) { em28xx_devused &= ~(1<devno); + kfree(dev->alt_max_pkt_size); mutex_unlock(&dev->lock); kfree(dev); goto err;