[PATCH] ld/pdb: Avoid double-free on malformed symbol data

Oleg Tolmatcev oleg.tolmatcev@gmail.com
Wed Sep 30 19:36:53 GMT 2026


When handle_debugs_section fails, create_module_info_substream frees
the file arrays for all modules, including the current one.  Do not free
the current array in populate_module_stream as well.

ld/
	* pdb.c (populate_module_stream): Leave mod_source->files cleanup to
	the caller.
---
 ld/pdb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ld/pdb.c b/ld/pdb.c
index 434bdb197ca..9988fd94f51 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -3955,7 +3955,6 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size,
 		{
 		  free (c13_info);
 		  free (syms);
-		  free (mod_source->files);
 		  free (map);
 		  return false;
 		}
-- 
2.56.0.windows.1



More information about the Binutils mailing list