Message ID | 20240204014409.333951-1-m.belouarga@technologyandstrategy.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCIOR6FIYQJBB36X7OWQMGQE4YD6A3Y@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=P4sJkFg4; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=POcYn8zH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::13f; helo=mail-lf1-x13f.google.com; envelope-from=swupdate+bncbcior6fiyqjbb36x7owqmgqe4yd6a3y@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lf1-x13f.google.com (mail-lf1-x13f.google.com [IPv6:2a00:1450:4864:20::13f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TSC3p03g8z1yhq for <incoming@patchwork.ozlabs.org>; Sun, 4 Feb 2024 12:44:20 +1100 (AEDT) Received: by mail-lf1-x13f.google.com with SMTP id 2adb3069b0e04-5114a9ea86asf216747e87.0 for <incoming@patchwork.ozlabs.org>; Sat, 03 Feb 2024 17:44:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707011057; cv=pass; d=google.com; s=arc-20160816; b=Q118NfHx8mNMYJJBR9XHjZ9ZA4rpuCueNjlsWNb9xVBezWij8kDsIk5ejddKfoUhlR mjhz57cWu+W6sKDp5e1U9/bl3EuKKZ6TYyGOEbkId9WivGAWAGGPoiUgrXRAUaRb/Hwa qy4+r+gQFuV2saOvXAczlweFFr+Xe1AChpUYXUkGscHvWp3txDSeddSgwmEsxZiromNO MQqlmE3gzVvrtdXATEtnwLtxSZRQE2Hag1lVzB1lLa9o5WoZlzwcMnApyyd5P2VGmuxc r50aKSsJTX6tYd2FQ/sNVTmesTT2t1eDrp/pStxRfSZKu0qX6xCbY32uq25OTRFVlEkq G1qA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature:dkim-signature; bh=FAXhovtbxp3kB0QbpTiuygPUTyfImkh8G8xsOBRFkOI=; fh=pYGW3sAqMDuZCl7t6dV7LN/9z4M9SX24G3o2OR7J89k=; b=ojj9PhpmteoBjm2pJiZq637v0Lx1xG7SMqOCmniUZ3fNwbdCRI3UydWrRPV81fGE0f HrrwfivuG9uJ+XsdLmBWZkkP3xBAgsePicViIui8E/GuHeJYo2AtJgUa8rwC7blXggh6 fKNvGOFQBCVDnu+WGFUdHwqgGedxodN8vTH1azwzhZWHgv9IfkJZWjRFAa9gwWHgTRkB trFTHiJ/8dzDkS4YRK7f1t1/Z20RKSZGSkD4WmyfU+pJl9Aw40Wl1CtHFOD5vrzotz5y nv/p1SJ6k+pnFAQfxaF8feJR676muK8LRKAT1TPGof9R9aUL8QERRz06bGy2iDMWnt9Q FgjQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SPmTKFH6; spf=pass (google.com: domain of belouargamohamed@gmail.com designates 2a00:1450:4864:20::430 as permitted sender) smtp.mailfrom=belouargamohamed@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1707011057; x=1707615857; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=FAXhovtbxp3kB0QbpTiuygPUTyfImkh8G8xsOBRFkOI=; b=P4sJkFg4yrKWRWRJ+mhox199EbUatp+LDlfbM9beOvjJ4hqExqk7D83JZdU+f2gzNF BrxBmXypg/EzpYxta19PDAEnEULVB5iBpEXk2OYCJ2qnaof2bY1J3/3ztDVePEIeSMxl g1r1J57n6pY9qxWm/QbtwvrmTOl0abkpsiwtS6CKoFSJ8cJo8O4dOewHLfaUM67wGSQT OwX+0/qLXB1O9MXUhWLoKqTSrcfyU+tyxhHbMFFSS7Q0viV8JReNKa/+0Ht6oBNCGEf6 Tn5u2/JFbL10UDo2kp7qeshwYGRVkwPRtkoSEUaw6TM9ycOr50OsN4c3jSlcLotZ7LVu nMfA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707011057; x=1707615857; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=FAXhovtbxp3kB0QbpTiuygPUTyfImkh8G8xsOBRFkOI=; b=POcYn8zHCZPY/is8JXFP7Ujmz8QAaf9Hh/M6MGAboSJ9ZYu44KGnITixj4PdQPFcni vMjXbpv5FLKp+Cv1nEAAY2AxvK9qzOle47ABpNipm2Di4cqa36rsHuozcmMiys1FSLNy 3+XGfir+2bec6DI4KTWJXzugYFsJ5d07Puipf4lZvbs5uY2FH+9uuXCIDLpkXMmOYvju DWRmbC09ts2DT51fzu1bjTn4G8doE83A+F9grdMW0nQVLLCvPU/FmVvX8N/OezB0nIMz OFHvW8Bx7Ev6xNYcSHqyng5zVke5CAc65AFDQtAlcuUtQJIivqJGmMRI0Ww49VbRT+WQ t02A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707011057; x=1707615857; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=FAXhovtbxp3kB0QbpTiuygPUTyfImkh8G8xsOBRFkOI=; b=tmC8HGG8j/xAKVsTxrul3AZb4xnPEC37wk1UHN61HLLzCBta235zAZi6E259aSBTha b6NHEW7LUwBaHJNQyven5oKfyFsysRE7w0w6c0LignXi/g7LipP4iZCMi4pEN3Rkaf8f qJ2nMKu91iYGpbJY4L06f+/jd4mnoyYRkhq3LxZ0k8DyH8Wt2e/F+vjOOObo/lEoqbOf WYziNMx+kZUBG1rQX+OTgaYGP3iYyA66Bx93NAKzkWUUHNQ86Mpoic9f7Kaccw68I3s/ FxQWmv/yyZTmOCWaioNDJ+IoS5hNLl5H3pgIiI88bs+cG3lqJ65OG7+Io/ruvjMxeiaT 7g2w== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Yz3fU1MajBT7I9AApsEMNiKrXoiPQX9NqbD6SeY68sLh8rOB494 3rZBD46b2zVgn6t/TjvDQuTapZXzDKP3AfRlRLi7sLHhLvpelCXr X-Google-Smtp-Source: AGHT+IGzwsw8zBT1rI/50P3mTGcSD10XfhoJtZWQEOvx245bzIhHClzbwAq0x56NYXIE5OZ0frKNvQ== X-Received: by 2002:a05:6512:2389:b0:511:3552:7eb2 with SMTP id c9-20020a056512238900b0051135527eb2mr4572604lfv.39.1707011056433; Sat, 03 Feb 2024 17:44:16 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6512:31ce:b0:511:4864:dd3d with SMTP id j14-20020a05651231ce00b005114864dd3dls31029lfe.0.-pod-prod-07-eu; Sat, 03 Feb 2024 17:44:14 -0800 (PST) X-Received: by 2002:a05:6512:21c1:b0:50e:6b5d:5976 with SMTP id d1-20020a05651221c100b0050e6b5d5976mr5800029lft.40.1707011053624; Sat, 03 Feb 2024 17:44:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707011053; cv=none; d=google.com; s=arc-20160816; b=0GQlyyiF4I0Zp8gkLMx+m6wKe2KZ2FeV89TZjEWYkCI3t0WTS9mLEszqlAsKsCijZa wkeU/lbe9UiM8WUqGQcCmg37glP5S3uHuRLAVx/NJEQTQCaRLNLGujwnlLcCrDkVx68w hiWlRROGxbqgwQWS6E8ACRk6M22zM1A9EfIHJOrFnS8kBPrakuz5NvGiPb4H7VRpbsZM P8A1aIxf5Qvmcp35c2Y1cm0ZrIcKR7EAhWtiXeXSBEEIDfIMYOmnf9HgCPd5Ju2WAWcD l9RCKIA2VWCAphiwjNKMsg9n2A1pSTrcLxfZyaj+wiLdv+oxirNSjbMwwgB0Vc7j+fz/ fFYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=5RLDLpa8n7s7uNuCBvUM3sPO36XkDc4IFPHoUjQlyrk=; fh=pYGW3sAqMDuZCl7t6dV7LN/9z4M9SX24G3o2OR7J89k=; b=MTnJ12T9q27ozE4v53LVLATxEcnfLqlsSOSqr3/qPefXFp3q2dXXoRyKFtcTOY8C4S rWlZmVrRHrA5l/54Z48stvquDwXgRHid9BSLh1wDSPd4OM0ODGmBErgdk5Rsspc+/i2r IeoUwIpOueWhsadHWnSBxEPZVynPc5l2W6TeUugPHqftavTjpjf0HMkYZkiqn4kICSZS juoaMcMLi90UcFZxSZTgiiY3i6MBPifut16RNqfKBRrmBS5txYGfdKPVsUAYuj0+wnds fNHE2k09+rIV/TPMKKUUiduJelOEPJEkPZQrjQ7OBAjsrjXtPv9FNv44Q5O4Pb2XcWeh 6ilw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SPmTKFH6; spf=pass (google.com: domain of belouargamohamed@gmail.com designates 2a00:1450:4864:20::430 as permitted sender) smtp.mailfrom=belouargamohamed@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com. [2a00:1450:4864:20::430]) by gmr-mx.google.com with ESMTPS id f12-20020a05651232cc00b005112f73df07si223011lfg.4.2024.02.03.17.44.13 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 Feb 2024 17:44:13 -0800 (PST) Received-SPF: pass (google.com: domain of belouargamohamed@gmail.com designates 2a00:1450:4864:20::430 as permitted sender) client-ip=2a00:1450:4864:20::430; Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33b1117bbe4so2257444f8f.0 for <swupdate@googlegroups.com>; Sat, 03 Feb 2024 17:44:13 -0800 (PST) X-Received: by 2002:a5d:4a0f:0:b0:33b:1bf2:18cf with SMTP id m15-20020a5d4a0f000000b0033b1bf218cfmr4002377wrq.17.1707011052043; Sat, 03 Feb 2024 17:44:12 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW5OZ4yCzIevMyJ3FYoaM/j1Qhc/6xWdCkYrlCFyVRXfCaNF0fhsCk0Aooz0ltPGaRWH+GFxNtxLa9VePcaGuiRCuWHs4eMSyfTVnDkeNhiuY4ck0Ka Received: from localhost.localdomain ([2a02:842a:10:ba01:bc23:9089:f11:f9ad]) by smtp.gmail.com with ESMTPSA id a18-20020adff7d2000000b0033b13922263sm4993817wrq.60.2024.02.03.17.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:44:11 -0800 (PST) From: belouargamohamed@gmail.com To: swupdate@googlegroups.com Cc: f.lahoudere@technologyandstrategy.com, BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com> Subject: [swupdate] [PATCH] bootloader: cboot: fix Resource leak Date: Sun, 4 Feb 2024 02:44:09 +0100 Message-Id: <20240204014409.333951-1-m.belouarga@technologyandstrategy.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: belouargamohamed@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SPmTKFH6; spf=pass (google.com: domain of belouargamohamed@gmail.com designates 2a00:1450:4864:20::430 as permitted sender) smtp.mailfrom=belouargamohamed@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
bootloader: cboot: fix Resource leak
|
expand
|
On 04.02.24 02:44, belouargamohamed@gmail.com wrote: > From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com> > > When a fail occurs, do_apply_list returns -ENOENT without freeing file > > Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com> > --- > bootloader/cboot.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/bootloader/cboot.c b/bootloader/cboot.c > index 1780e5f..db07639 100644 > --- a/bootloader/cboot.c > +++ b/bootloader/cboot.c > @@ -138,6 +138,7 @@ static int do_apply_list(const char *filename) > int result = 0; > if (libcboot.open(BOOTINFO_O_RDWR, &ctx) < 0) { > ERROR("libcboot.open returns with error"); > + close(file); > return -ENOENT; > } > while ((getline(&line, &length, file)) != -1) { Reviewed-by: Stefano Babic <stefano.babic@swupdate.org> Best regards, Stefano Babic
diff --git a/bootloader/cboot.c b/bootloader/cboot.c index 1780e5f..db07639 100644 --- a/bootloader/cboot.c +++ b/bootloader/cboot.c @@ -138,6 +138,7 @@ static int do_apply_list(const char *filename) int result = 0; if (libcboot.open(BOOTINFO_O_RDWR, &ctx) < 0) { ERROR("libcboot.open returns with error"); + close(file); return -ENOENT; } while ((getline(&line, &length, file)) != -1) {