public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] elfcompress: remove redundant assignment
@ 2021-05-12 15:00 Dmitry V. Levin
  2021-05-12 20:20 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry V. Levin @ 2021-05-12 15:00 UTC (permalink / raw)
  To: elfutils-devel

At the point of "Nothing to do" fnew variable has not been assigned
after initialization, so it does not have to be reset to NULL.

Note that any reset of fnew to NULL has to preceded with free(fnew).

Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")
---
 src/ChangeLog     | 3 +++
 src/elfcompress.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 47c7eb79..de130f79 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
 2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
 
+	* elfcompress.c (process_file): Remove redundant assignment in case of
+	"Nothing to do".
+
 	* elfcompress.c (process_file): Set res to 0 in case of "Nothing to do".
 
 2021-04-19  Martin Liska  <mliska@suse.cz>
diff --git a/src/elfcompress.c b/src/elfcompress.c
index 7340e878..05f3bc2c 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -521,7 +521,6 @@ process_file (const char *fname)
     {
       if (verbose > 0)
 	printf ("Nothing to do.\n");
-      fnew = NULL;
       res = 0;
       goto cleanup;
     }
-- 
ldv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] elfcompress: remove redundant assignment
  2021-05-12 15:00 [PATCH 2/2] elfcompress: remove redundant assignment Dmitry V. Levin
@ 2021-05-12 20:20 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2021-05-12 20:20 UTC (permalink / raw)
  To: Dmitry V. Levin; +Cc: elfutils-devel

Hi Dmitry,

On Wed, May 12, 2021 at 03:00:00PM +0000, Dmitry V. Levin wrote:
> At the point of "Nothing to do" fnew variable has not been assigned
> after initialization, so it does not have to be reset to NULL.
> 
> Note that any reset of fnew to NULL has to preceded with free(fnew).
> 
> Fixes: ed62996defc6 ("elfcompress: Don't rewrite file if no section data needs to be updated.")

You are right. The NULL assignment is redundant at that spot.

Thansk,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-12 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 15:00 [PATCH 2/2] elfcompress: remove redundant assignment Dmitry V. Levin
2021-05-12 20:20 ` Mark Wielaard

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