From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by mx.groups.io with SMTP id smtpd.web12.8380.1660599838818390419 for ; Mon, 15 Aug 2022 14:43:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qla2Yixr; spf=pass (domain: gmail.com, ip: 209.85.208.182, mailfrom: mike.maslenkin@gmail.com) Received: by mail-lj1-f182.google.com with SMTP id bx38so8844485ljb.10 for ; Mon, 15 Aug 2022 14:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc; bh=gdsAyk4v8W831021hUgMqgd/U68LOkG4DWHUY85nxX8=; b=qla2YixrdpNdEFqOiYZdkRyfEzJG89N791zSfOuFclcqqqqUMzDsGDnLeS125TLXkx 8+jhMaTBnmKnOjIneptk7/L1YtroEszAvFv30s+tlZv9loYzC/NSefW7p19qPASL26hX DqjlCsjxLuqd/KO0tTzK5EDzU5d/JXRI9nIrtRWKWQaByfOKd82Ve/OTHrvYA8wyZuPK LbRVsS+1MYFt+MFGu+W8ZzwPEsNhzAlPxYhBhqHzQrvgYvALJD+J7U6dXuRDlJRO9Nsy KvaPHGnvzSYDOAB3W11nZNQF8oI95xHPVR/p/QY+ZF1FiyxRU34JU5i8SqUu1urJ4h3t Y7fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=gdsAyk4v8W831021hUgMqgd/U68LOkG4DWHUY85nxX8=; b=D8ANRpJ53pD30fXL9trCDuP0Bnfw0lwjaDzw65LYSkxCXy1uyz/7MHzSlrRpCMGPHr 3Y6ljZd/Gzz5kxaCQct1tv0TWEPuXjWj7BoAqPPvAvJqTLnBfG2acAn6h50OTfCpJ9ju 3rA/OXapURqruaOxvJvNQyn14eIyhbeZ1ZtDztk8KOOM6ZEzqGA41shx1IsHIm8tQ/2I BbHo5z+dRg7knOD5on2bQGQB2rnsGn9TJzbBb/4tBPjkRjcozKdVlBNT5MOxvJIs5osc AuHE2AZ+yWfOo7z9bO1Tj0T/rZDxXy2hrK6vAVfF7Z0KObYDcAbAwDKkiJyuCLxMqia6 Bl7w== X-Gm-Message-State: ACgBeo0TuCDULP2i7u8Zzs2A1U82krFM5hYMweRZUB0NM54AgG3EmsMg yA7aB+ivSXsGBAcMC5pfy119GSNaPeQ= X-Google-Smtp-Source: AA6agR4H7UZIgbh2nmfWxwpH7yU5OVI7PdyHAnz7jbd+tnvf1z+FBwTh/CwhpzhahPikwD2m3bj5RQ== X-Received: by 2002:a2e:9109:0:b0:261:7a73:5f20 with SMTP id m9-20020a2e9109000000b002617a735f20mr4628601ljg.366.1660599837013; Mon, 15 Aug 2022 14:43:57 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b0048a82fec50esm1195266lfs.305.2022.08.15.14.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 14:43:56 -0700 (PDT) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: Mike Maslenkin , Liming Gao , Dandan Bi Subject: [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c Date: Mon, 15 Aug 2022 21:41:38 +0000 Message-Id: <20220815214138.15318-3-mike.maslenkin@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220815214138.15318-1-mike.maslenkin@gmail.com> References: <20220815214138.15318-1-mike.maslenkin@gmail.com> FvbDev->LbaCache must be freed on error path before deallocating FvbDev. Cc: Liming Gao Cc: Dandan Bi Signed-off-by: Mike Maslenkin --- MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c index d81334ce24d1..9f5f40e5cd49 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -551,6 +551,7 @@ ProduceFVBProtocolOnBuffer ( // FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate); if (FvbDev->DevicePath == NULL) { + FreePool (FvbDev->LbaCache); FreePool (FvbDev); return EFI_OUT_OF_RESOURCES; } @@ -563,6 +564,7 @@ ProduceFVBProtocolOnBuffer ( // FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate); if (FvbDev->DevicePath == NULL) { + FreePool (FvbDev->LbaCache); FreePool (FvbDev); return EFI_OUT_OF_RESOURCES; } -- 2.17.1