From patchwork Sat Mar 15 12:22:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Pandit X-Patchwork-Id: 3836901 Return-Path: X-Original-To: patchwork-linux-btrfs@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 577D99F369 for ; Sat, 15 Mar 2014 12:23:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23F4720131 for ; Sat, 15 Mar 2014 12:23:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 93D9D2012B for ; Sat, 15 Mar 2014 12:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755262AbaCOMWm (ORCPT ); Sat, 15 Mar 2014 08:22:42 -0400 Received: from nbl-ex10-fe02.nebula.fi ([188.117.32.122]:31418 "EHLO ex10.nebula.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755075AbaCOMWl (ORCPT ); Sat, 15 Mar 2014 08:22:41 -0400 Received: from localhost.localdomain (88.195.158.30) by ex10.nebula.fi (188.117.32.115) with Microsoft SMTP Server (TLS) id 14.3.174.1; Sat, 15 Mar 2014 14:29:22 +0200 Date: Sat, 15 Mar 2014 14:22:37 +0200 From: Rakesh Pandit To: Subject: [PATCH] Btrfs-progs: fsck: fix memory leak and unnecessary call to free Message-ID: <20140315122235.GA9023@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.195.158.30] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Free already allocated memory to item1_data if malloc fails for item2_data in swap_values. Seems to be a typo from commit 70749a77. Signed-off-by: Rakesh Pandit --- cmds-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index d1cafe1..60708d0 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -2380,7 +2380,7 @@ static int swap_values(struct btrfs_root *root, struct btrfs_path *path, return -ENOMEM; item2_data = malloc(item2_size); if (!item2_data) { - free(item2_data); + free(item1_data); return -ENOMEM; }