Segmentation fault i386-gen

Alan Modra amodra@gmail.com
Tue Jan 26 10:29:55 GMT 2021


A case of inst->next being uninitialised.

	* i386-gen.c (parse_template): Ensure entire template_instance
	is initialised.

diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index b3c87dbbd66..44cdc661985 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -1576,6 +1576,8 @@ parse_template (char *buf, int lineno)
       *end++ = '\0';
 
       inst = xmalloc (sizeof (*inst));
+      inst->next = NULL;
+      inst->args = NULL;
 
       cur = next_field (buf, ':', &next, end);
       inst->name = xstrdup (cur);

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list