[02/17] elf-based-reader: Clean up logic of elf_based_reader::read_and_add_corpus_to_group

Message ID 20240716145541.473065-3-dodji@redhat.com
State New
Headers
Series Support self comparison of vmlinux & modules using BTF/CTF |

Commit Message

Dodji Seketeli July 16, 2024, 2:55 p.m. UTC
  From: Dodji Seketeli <dodji@redhat.com>

While looking at something else, I noticed the logic of
elf_based_reader::read_and_add_corpus_to_group wasn't clear.  The
corpus should be read (thus created) first, then added to the reader.
Fixed thus.

	* src/abg-elf-based-reader.cc
	(elf_based_reader::read_and_add_corpus_to_group): Fix logic.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-elf-based-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/abg-elf-based-reader.cc b/src/abg-elf-based-reader.cc
index 123e5fec..32c0699e 100644
--- a/src/abg-elf-based-reader.cc
+++ b/src/abg-elf-based-reader.cc
@@ -107,8 +107,8 @@  ir::corpus_sptr
 elf_based_reader::read_and_add_corpus_to_group(ir::corpus_group& group,
 					       fe_iface::status& status)
 {
-  group.add_corpus(corpus());
   ir::corpus_sptr corp = read_corpus(status);
+  group.add_corpus(corp);
   return corp;
 }