[committed] Fix uninitialized var in dwz_one_file
Tom de Vries
tdevries@suse.de
Thu Mar 25 13:55:47 GMT 2021
Hi,
The commit dbfecee "Move hardlink handling out of dwz function" added
initialization of res->res in dwz_files_1, but failed to do the same
in dwz_one_file.
Add the missing initialization by factoring out the initialization code from
dwz_files_1, and using it in dwz_one_file.
Committed to trunk.
Thanks,
- Tom
Fix uninitialized var in dwz_one_file
2021-03-25 Tom de Vries <tdevries@suse.de>
* dwz.c (init_file_result): Factor out of ...
(dwz_files_1): ... here.
(dwz_one_file): Use init_file_result.
---
dwz.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dwz.c b/dwz.c
index e132d0e..b865a92 100644
--- a/dwz.c
+++ b/dwz.c
@@ -16238,6 +16238,14 @@ dwz_with_low_mem (const char *file, const char *outfile,
return ret;
}
+/* Initialize struct file_result RES. */
+static void
+init_file_result (struct file_result *res)
+{
+ res->die_count = 0;
+ res->res = -3;
+}
+
/* Dwarf-compress FILE. If OUTFILE, write to result to OUTFILE, otherwise
modify FILE. */
static int
@@ -16248,7 +16256,7 @@ dwz_one_file (const char *file, const char *outfile)
if (stats_p)
init_stats (file);
- res.die_count = 0;
+ init_file_result (&res);
return dwz_with_low_mem (file, outfile, &res, NULL);
}
@@ -16375,10 +16383,7 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink,
int successcount = 0;
for (i = 0; i < nr_files; ++i)
- {
- resa[i].die_count = 0;
- resa[i].res = -3;
- }
+ init_file_result (&resa[i]);
if (multifile)
{
More information about the Dwz
mailing list