From patchwork Mon Nov 20 07:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Korotkov X-Patchwork-Id: 13460892 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1A8DC197A0 for ; Mon, 20 Nov 2023 07:55:36 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1r4z84-0002G1-EC; Mon, 20 Nov 2023 07:55:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r4z7z-0002Fp-57 for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Nov 2023 07:55:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=AakIS7gjBUkb4rimXmYmgZJQZetziS+ULe2MTjK0V8s=; b=SmVectLd+SuxZ6WIMTGKl4JKmL lj6BoH1ykI3dji2klm218mgOHKppLeUaut6Zh+ZNnGC+XH+HtwvxMmt/60gPWzUKeu4xIz5SjaPOh uCgktPeQZaAmkj/06ct952zGKf99sk+2KDHzcYWJEB+pTGJfF9vwf8g9rlr5IKAlNm+k=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AakIS7gjBUkb4rimXmYmgZJQZetziS+ULe2MTjK0V8s=; b=VAjqdSucalwT6FoeG6PcanGwUk 66ylSYtHGl8R9dUdw3azhDIqbT4Gt4VVzQvHQ/mRHWdWk9fgCjPchB22gvMQVGQ0TeoV/DPDfha5f fCcex1q5vzR0NCFqxQ02R2eLPuXlvwoh9O5v8aLZzBrdmWfse0bnvch8Hc4IfD48CfOA=; Received: from mail-lf1-f43.google.com ([209.85.167.43]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1r4z7w-00AmL5-Vj for linux-f2fs-devel@lists.sourceforge.net; Mon, 20 Nov 2023 07:55:29 +0000 Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-507bd64814fso5639254e87.1 for ; Sun, 19 Nov 2023 23:55:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700466922; x=1701071722; darn=lists.sourceforge.net; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AakIS7gjBUkb4rimXmYmgZJQZetziS+ULe2MTjK0V8s=; b=FBBF7N4zj6vQooRaKoYsGfTF9IbNUFhenPu7TFRHriqINc6Ed1FPL8vYC61jLwdiS4 dCgL7482M4WnxmeKtNR8O/XSyZJ3iPnzY2g2iE9/w/HxSiN8x9rLe+dJDANuNnmuZNNM rysIZscqZyP6LFe+ZUw5cQkHyrHSZ2L7RpDM8T+hRNW1GBP8yneh6yHw6wNFBGQomZrV 2kvUSy7tBLs/+Tqq1u38OD0xnthXlUB+xxmuZjNEG3XcOGOTs6ImwfVyoPNz+TepOmM1 1SU/GUyN2PuOnwq5OI/yham4oauAd7c/ZEUYDYMQp9PiDHmFuWZamGxFwxMLCiESpDhz 0KHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700466922; x=1701071722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AakIS7gjBUkb4rimXmYmgZJQZetziS+ULe2MTjK0V8s=; b=scKnY0K+741Aayz8Yc0lkc0Zw52vBHmrQbJcNx6M9LNa3wU0oe72eY2GRK69HVMN7t y3WHfJqFWMEH6fqIM0Rlgr7IMPqMV2VqVQiGX8eskO4W8GjM+1G+WXeARr9HRCi8pBNP uFEpYlyVznQ6murlVrxtnSSxYeChIdQ1GyS1fcifVhHjcPK2H/xul2Ut2v3x/5DWFPTT BjEHku8GF6m3LoNmXtWWsLGp/vwDIZhTT0gb2yAvo0dt/a8+P7TTQdxl6m/WqX4/gMHK C3qJtdoFEoH9f55rWyfyGuHrfMqZ1HQNQOdf4ovAYg7o4kZ4jVGT+4JI/FDqkhWCNKRA qWug== X-Gm-Message-State: AOJu0YzzB0+KdrIUjj7FJBCkVbJNzRqNsCKnJEm7nt100jIFDr5ahbDU 2ABnFg9KztvUoWPcjf+3r7Q= X-Google-Smtp-Source: AGHT+IGtUHouHuifutXj4JYY1dMd+Hmn+KUUV9GGwiazh1XML5bNImKMH32wJQcGBTT7WWQg6xctkA== X-Received: by 2002:a05:6512:2c0b:b0:50a:ab3e:cac with SMTP id dx11-20020a0565122c0b00b0050aab3e0cacmr2569822lfb.22.1700466922029; Sun, 19 Nov 2023 23:55:22 -0800 (PST) Received: from localhost.localdomain ([212.22.67.162]) by smtp.gmail.com with ESMTPSA id m25-20020ac24ad9000000b005079fa0b1c3sm1097111lfp.243.2023.11.19.23.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 23:55:21 -0800 (PST) From: Maxim Korotkov To: Aravind Ramesh Date: Mon, 20 Nov 2023 10:55:04 +0300 Message-Id: <20231120075504.455510-1-korotkov.maxim.s@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120065507.423065-1-korotkov.maxim.s@gmail.com> References: <20231120065507.423065-1-korotkov.maxim.s@gmail.com> MIME-Version: 1.0 X-Headers-End: 1r4z7w-00AmL5-Vj Subject: [f2fs-dev] [PATCH v2] f2fs-tools: fixed incorrect error handling X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim , Maxim Korotkov , Maxim Korotkov , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Case of failed memory allocation of dev->zone_cap_blocks doesn't release heap allocated rep Found by RASU JSC Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support) Signed-off-by: Maxim Korotkov Reviewed-by: Chao Yu --- changeset: - editted description lib/libf2fs_zoned.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c index 56c97d1..81088af 100644 --- a/lib/libf2fs_zoned.c +++ b/lib/libf2fs_zoned.c @@ -293,6 +293,7 @@ int f2fs_check_zones(int j) dev->zone_cap_blocks = malloc(dev->nr_zones * sizeof(size_t)); if (!dev->zone_cap_blocks) { + free(rep); ERR_MSG("No memory for zone capacity list.\n"); return -ENOMEM; }