public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Fix uninitialized var in dwz_one_file
Date: Thu, 25 Mar 2021 14:55:47 +0100	[thread overview]
Message-ID: <20210325135545.GA10035@delia> (raw)

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

                 reply	other threads:[~2021-03-25 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325135545.GA10035@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).