public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Fix uninitialized var in dwz_one_file
@ 2021-03-25 13:55 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-03-25 13:55 UTC (permalink / raw)
  To: dwz, jakub, mark

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)
     {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-25 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 13:55 [committed] Fix uninitialized var in dwz_one_file Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).