Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp774376ybt; Fri, 19 Jun 2020 13:26:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxujas0q/UFg0dZeto9tbaB2lUKl2vtE4F2swEFyWAj/os4DfRxvv8x5dbUtvTmGGsTD43B X-Received: by 2002:aa7:d785:: with SMTP id s5mr5322084edq.17.1592598366884; Fri, 19 Jun 2020 13:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592598366; cv=none; d=google.com; s=arc-20160816; b=Ic/s3U01nEWYeU3tHenjjUb8K6zN+KDzhgUGXOyN7G1ImIZJGiXDWuvShXofq1Gdzp Mj5Hoaj5TyjET3orVwaImzEYKPbXem/fplIgd8fiFoGGF/3v805OyKwKAJrJO1gFflgj X9MCgEFmdAqsg+ULePMaIYoqRKsQCFZXg9/020Hvds2bpej9CoqUKl/AJ0vIDh5aebp5 VtaUrdSnwff+9FzuVfMQb1t9Ylto3HCFLlUHDPkA4pjOk61jRrDAzew6lQoKYnbdJF/y 4GFExxgMlc+nlFMsMnqXSAHzauPD49In0VgO+Ksb7FvOW87o65ijnU8i6/WN4aw9M2gP S++w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W++O5QmyjR1s7QfCJYTFTARivhRSNEHiLybjbbV5byQ=; b=eWzDnnstLjHqw8YR51PC3MUNVqBYk/6wDeNEa9Zi/kEQUi2Ib923adYvXgBuAmGv36 gDjqzlb1jkihG1aNaeor1lk0JgNeJwUgWfltho7IQcAZxd1Ng55uDqMNXMQLyIGP01+z fk/fsxBGK1w08FPilynQATaMV8SYN/VNin6n7VkUu/R5SnFf8nGMfObfrlKF+0UpD+Lh +08wAKZF8en+it6TlBpjusZQPJ0/ST9bS9RU9xLP/KKBWdJR1dShwSxRU6TD8rOsJUzr cJshFMZKjQJAu/c7z8OPscbS8KIgc5fut1fx8ecGDvc74UHNopartYn2POaTT5jlz9im 4/5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AoBrptv1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be28si4661900edb.525.2020.06.19.13.25.44; Fri, 19 Jun 2020 13:26:06 -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=AoBrptv1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390427AbgFSO6t (ORCPT + 99 others); Fri, 19 Jun 2020 10:58:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:54590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390003AbgFSO6m (ORCPT ); Fri, 19 Jun 2020 10:58:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B86621919; Fri, 19 Jun 2020 14:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578722; bh=uZ84vTGYlo4IboKjY879TBGBz6Hhr7Vq0yu0/6vxmZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AoBrptv1aLqfFRCusBhKIO+8MPYuihKpIK7nwwAhzLp1wfXx3eME6V36k36ijblyL BW+b542Xl4AtcxCnJNrg76L2EmIgoXNS5xDl5a8udPDWcxsr72GZK+L1faasj289t5 aVhUTfWvZrWEWsGLn4jypxtR9sYNkJhl1Pm1kMxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Nakryiko , Alexei Starovoitov , Song Liu , Sasha Levin Subject: [PATCH 4.19 132/267] selftests/bpf: Fix memory leak in extract_build_id() Date: Fri, 19 Jun 2020 16:31:57 +0200 Message-Id: <20200619141655.160330334@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 89f8b0dae7ef..bad3505d66e0 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -1118,6 +1118,7 @@ static 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