1From f47672bed5905ae382e80b09dafca9a8da45aa67 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 19 Apr 2022 18:44:36 -0700
4Subject: [PATCH] ppc/plt: do not free symbol libsym
5
6delete_symbol_chain() will call free as well if sybol is non-null
7it also fixes use-after-free warnings that compiler emits
8
9Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/2]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 sysdeps/linux-gnu/ppc/plt.c | 1 -
13 1 file changed, 1 deletion(-)
14
15diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
16index 5f81889..7c1c025 100644
17--- a/sysdeps/linux-gnu/ppc/plt.c
18+++ b/sysdeps/linux-gnu/ppc/plt.c
19@@ -687,7 +687,6 @@ arch_elf_add_func_entry(struct process *proc, struct ltelf *lte,
20 		if (libsym == NULL
21 		    || library_symbol_init(libsym, addr, full_name, 1,
22 					   LS_TOPLT_NONE) < 0) {
23-			free(libsym);
24 			delete_symbol_chain(libsym);
25 			libsym = NULL;
26 			fprintf(stderr, "Couldn't add symbol %s"
27--
282.36.0
29
30