Fix freeing of link_info.hash
[binutils-gdb.git] / ld / ldmain.c
index 4c7ea68f41e786a845beb737dd4d48318b869d01..2d987b827a7a893bdb3e78bc65054b02eb96857f 100644 (file)
@@ -171,6 +171,10 @@ ld_cleanup (void)
 #endif
   if (output_filename && delete_output_file_on_failure)
     unlink_if_ordinary (output_filename);
+
+  /* See open_output in ldlang.c.  */
+  if (output_bfd_hash_table_free_fn != NULL)
+    (*output_bfd_hash_table_free_fn) (link_info.hash);
 }
 
 /* If there's a BFD assertion, we'll notice and exit with an error