From patchwork Fri Jul 20 18:46:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 1222131 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 2F690E0038 for ; Fri, 20 Jul 2012 18:46:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC80CA115A for ; Fri, 20 Jul 2012 11:46:44 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from swampdragon.chaosbits.net (1010ds2-suoe.0.fullrate.dk [90.184.90.115]) by gabe.freedesktop.org (Postfix) with ESMTP id C64DE9EE9C for ; Fri, 20 Jul 2012 11:46:33 -0700 (PDT) Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id 7C8999403D; Fri, 20 Jul 2012 20:46:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 74D1C9403B; Fri, 20 Jul 2012 20:46:31 +0200 (CEST) Date: Fri, 20 Jul 2012 20:46:31 +0200 (CEST) From: Jesper Juhl To: David Airlie Subject: [PATCH] drm, ast_fb: Fix a small leak in astfb_create() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Cc: Dave Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org We have this code: ... sysram = vmalloc(size); if (!sysram) return -ENOMEM; info = framebuffer_alloc(0, device); if (!info) { ret = -ENOMEM; goto out; } ... We'll leak the memory allocated to 'sysram' if the framebuffer_alloc() call fails and the variable goes out of scope. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/ast/ast_fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c index 2fc8e9e..260a760 100644 --- a/drivers/gpu/drm/ast/ast_fb.c +++ b/drivers/gpu/drm/ast/ast_fb.c @@ -180,6 +180,7 @@ static int astfb_create(struct ast_fbdev *afbdev, info = framebuffer_alloc(0, device); if (!info) { + vfree(sysram); ret = -ENOMEM; goto out; }