From patchwork Mon Mar 21 10:13:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Czerner X-Patchwork-Id: 87734 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 983C4B6F12 for ; Mon, 21 Mar 2011 21:14:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752794Ab1CUKN4 (ORCPT ); Mon, 21 Mar 2011 06:13:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18857 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704Ab1CUKNw (ORCPT ); Mon, 21 Mar 2011 06:13:52 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2LADp2Q005327 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Mar 2011 06:13:51 -0400 Received: from dhcp-27-109.brq.redhat.com (vpn-11-122.rdu.redhat.com [10.11.11.122]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2LADnG2014183; Mon, 21 Mar 2011 06:13:49 -0400 From: Lukas Czerner To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Lukas Czerner Subject: [PATCH] e2fsprogs: fix freeing bitmap in allocation error path Date: Mon, 21 Mar 2011 11:13:41 +0100 Message-Id: <1300702421-4774-1-git-send-email-lczerner@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In ext2fs_alloc_generic_bmap() error path, when new bitmap allocation fails ext2fs_generic_bitmap should be freed, however in current state it first frees ext2fs_generic_bitmap and then ext2fs_generic_bitmap->description which is wrong. This commit fix the free ordering. Signed-off-by: Lukas Czerner --- lib/ext2fs/gen_bitmap64.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c index df095ac..8b9e4c5 100644 --- a/lib/ext2fs/gen_bitmap64.c +++ b/lib/ext2fs/gen_bitmap64.c @@ -129,8 +129,8 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic, retval = bitmap->bitmap_ops->new_bmap(fs, bitmap); if (retval) { - ext2fs_free_mem(&bitmap); ext2fs_free_mem(&bitmap->description); + ext2fs_free_mem(&bitmap); return retval; }