Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp113002ybg; Mon, 8 Jun 2020 17:58:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4i4480q4hEC9/fE/G5Ztnm4YE0wUcO4jj8yzPwOGRl4cDGyfUGHdk9K/voErsLjkdwRnP X-Received: by 2002:a17:906:ae81:: with SMTP id md1mr16452923ejb.128.1591664330478; Mon, 08 Jun 2020 17:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664330; cv=none; d=google.com; s=arc-20160816; b=ezS0dGbKH+5hSw+kRbGjxoDKNM+Rzn8SxDjEr+dZmUVcNRPXbI6C20K82/ng9Ilzjl 9001LmutN1HUmwVpx66ASOekepm+hfv5DuhZpVzxDZAS9fGGY5u16c5XFg9EZ1rzyGBx 6aifmB7vOxN1GMnmgK7LZP9bVXHq5I/tpLmhd5wzPYpLz3uS+ecU6tOdcTepVKadv2VG 8CBPKGHd73TGk5e4hK3La6wK5w4mWdUqQT38GxrMM2k0L3dr/M3wIXopvkWVChiVu9os rv0XnpMVZbCPxJX4kVA1++ze1q6QTzYo5bRV32GngMR+8cnJaxOK/JFr0G+dtmUhbXIW E+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iTOal4J/yWTcR/A3MTUwaqsyj34MH3eu5IT8REm8Nxw=; b=AH1dST/vz8HIUcQebdzhabyXoCpcZSpeDOan3Gy0E6tWmSCV6aBpL+j30Q/2a5zH8X zYb7P+3jF1crIrnWXZSHM4GL3bzMp8tyhKmLAByhEHdp5uGs6tFF69q2805BYWWtMhCT 5MajMgbGfgsVP1iskB2+jptbxDyOIKUnii3F6mgiWFd0Gp1se4LLGMM+sOWwsruXv6HV b2S2I4St1pxwifAX5895YVfb6QYRJpfB5sjFMxoMjuY10N0r0SFCe8skAObgcdRRDPd6 w5spGra7q27PzcGa09SaKcgIBCNAsgLiHgmHd/5yODaZj09eQPcbrPspm29WmOGcqJ9Q V9QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZjeVo+bg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si9686255edv.322.2020.06.08.17.58.27; Mon, 08 Jun 2020 17:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZjeVo+bg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388024AbgFIA4g (ORCPT + 99 others); Mon, 8 Jun 2020 20:56:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:54640 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727032AbgFHXJD (ORCPT ); Mon, 8 Jun 2020 19:09:03 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB17120897; Mon, 8 Jun 2020 23:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657742; bh=tHgLy2WBJHYxlwWYiAqfHC5kG4VoDvhBZLkmec1G7tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjeVo+bgkrSoq4ezmky1uef9fp4JAJpdj6tUG/z9TIXZucAycWCsB8CGzKqun9fFs hm1wVkCOQSOP6PXaEW1lTXdPMPtOTNo0C1muRCHJagbSHMbt6eIjVQzeKuLnAE9ca5 Xxjh/2k2v5LWJR5Mqi05m1bequd4EFmaAXVk3Jxs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andrii Nakryiko , Alexei Starovoitov , Song Liu , Sasha Levin , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 131/274] selftests/bpf: Fix memory leak in extract_build_id() Date: Mon, 8 Jun 2020 19:03:44 -0400 Message-Id: <20200608230607.3361041-131-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrii Nakryiko [ Upstream commit 9f56bb531a809ecaa7f0ddca61d2cf3adc1cb81a ] getline() allocates string, which has to be freed. Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Cc: Song Liu Link: https://lore.kernel.org/bpf/20200429012111.277390-7-andriin@fb.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_progs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 86d0020c9eec..93970ec1c9e9 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -351,6 +351,7 @@ int extract_build_id(char *build_id, size_t size) len = size; memcpy(build_id, line, len); build_id[len] = '\0'; + free(line); return 0; err: fclose(fp); -- 2.25.1