Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753527AbbEQLDJ (ORCPT ); Sun, 17 May 2015 07:03:09 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:26274 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244AbbEQK5v (ORCPT ); Sun, 17 May 2015 06:57:51 -0400 From: Wang Nan To: , , , , , , , , , , CC: , , Subject: [RFC PATCH v3 19/37] bpf tools: Clear libelf and ELF parsing resrouce to finish opening Date: Sun, 17 May 2015 10:56:44 +0000 Message-ID: <1431860222-61636-20-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.200] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5558741E.0061,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 78fc94bb4fa7a48ed87b056875753ae7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 877 Lines: 30 After all eBPF programs in an object file are loaded, related ELF information is useless. Close the object file and free those memory. Signed-off-by: Wang Nan --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index ded96cb..9ed8cca 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -687,8 +687,8 @@ struct bpf_object *bpf_open_object(const char *path) if (bpf_obj_validate(obj)) goto out; + bpf_obj_clear_elf(obj); return obj; - out: bpf_close_object(obj); return NULL; -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/