memory leak in gas dwarf2dbg.c
Alan Modra
amodra@gmail.com
Wed Jan 1 12:38:38 GMT 2025
Found when running the pr27355 testcase.
PR 27355
PR 27426
* dwarf2dbg.c (allocate_filename_to_slot): Update dirs_in_use.
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index b84f5457949..2963e52958a 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -883,6 +883,8 @@ allocate_filename_to_slot (const char *dirname,
}
dirs[files[num].dir] = xmemdup0 (dirname, strlen (dirname));
+ if (dirs_in_use <= files[num].dir)
+ dirs_in_use = files[num].dir + 1;
}
return true;
@@ -911,6 +913,8 @@ allocate_filename_to_slot (const char *dirname,
}
dirs[files[num].dir] = xmemdup0 (filename, file - filename);
+ if (dirs_in_use <= files[num].dir)
+ dirs_in_use = files[num].dir + 1;
}
return true;
}
--
Alan Modra
More information about the Binutils
mailing list