summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/bpf/elf.c')
-rw-r--r--tools/lib/bpf/elf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/elf.c b/tools/lib/bpf/elf.c
index c92e02394159..b5ab1cb13e5e 100644
--- a/tools/lib/bpf/elf.c
+++ b/tools/lib/bpf/elf.c
@@ -28,6 +28,9 @@ int elf_open(const char *binary_path, struct elf_fd *elf_fd)
int fd, ret;
Elf *elf;
+ elf_fd->elf = NULL;
+ elf_fd->fd = -1;
+
if (elf_version(EV_CURRENT) == EV_NONE) {
pr_warn("elf: failed to init libelf for %s\n", binary_path);
return -LIBBPF_ERRNO__LIBELF;