Skip to contentSkip to conversation

libbpf: Fix error path in bpf_object__elf_init()

PATCH Applied Namhyung Kim 2 participants 2 messages Mar 17, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: Fix error path in bpf_object__elf_init()

When it failed to get section names, it should call bpf_object__elf_finish() like others.

---
 tools/lib/bpf/libbpf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +2 -1
index 2f351d3ad3e7..8d610259f4be 100644
@@ -1194,7 +1194,8 @@ static int bpf_object__elf_init(struct bpf_object *obj)
 	if (!elf_rawdata(elf_getscn(obj->efile.elf, obj->efile.shstrndx), NULL)) {
 		pr_warn("elf: failed to get section names strings from %s: %s\n",
 			obj->path, elf_errmsg(-1));
-		return -LIBBPF_ERRNO__FORMAT;
+		err = -LIBBPF_ERRNO__FORMAT;
+		goto errout;
 	}
 
 	/* Old LLVM set e_machine to EM_NONE */
Signature · 1 line
2.31.0.rc2.261.g7f71774620-goog
#1 lore raw
This patch was applied to bpf/bpf.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

Quoted 7 lines · On Wed, 17 Mar 2021 23:54:14 +0900 you wrote:

When it failed to get section names, it should call bpf_object__elf_finish() like others.

---
 tools/lib/bpf/libbpf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- libbpf: Fix error path in bpf_object__elf_init()

    https://git.kernel.org/bpf/bpf/c/8f3f5792f294

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html