git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: jrnieder@gmail.com
Cc: git@vger.kernel.org, Stefan Beller <stefanbeller@gmail.com>,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH 1/3] mv: free memory at the end if desired
Date: Mon, 16 May 2016 20:22:45 -0700	[thread overview]
Message-ID: <20160517032247.25092-2-sbeller@google.com> (raw)
In-Reply-To: <20160517032247.25092-1-sbeller@google.com>

From: Stefan Beller <stefanbeller@gmail.com>

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 Makefile     | 7 ++++++-
 builtin/mv.c | 7 +++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3f03366..e533257 100644
--- a/Makefile
+++ b/Makefile
@@ -389,7 +389,8 @@ CFLAGS += -Werror \
 	-Wpointer-arith \
 	-Wstrict-prototypes \
 	-Wunused \
-	-Wvla
+	-Wvla \
+	-DFREE_ALL_MEMORY
 endif
 
 # Create as necessary, replace existing, make ranlib unneeded.
@@ -1479,6 +1480,10 @@ ifdef HAVE_GETDELIM
 	BASIC_CFLAGS += -DHAVE_GETDELIM
 endif
 
+ifdef FREE_ALL_MEMORY
+	BASIC_CFLAGS += -DFREE_ALL_MEMORY
+endif
+
 ifeq ($(TCLTK_PATH),)
 NO_TCLTK = NoThanks
 endif
diff --git a/builtin/mv.c b/builtin/mv.c
index a201426..c48dbb9 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -282,5 +282,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	    write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
 		die(_("Unable to write new index file"));
 
+#ifdef FREE_ALL_MEMORY
+	free(destination);
+	free(source);
+	free(submodule_gitfile);
+	free(modes);
+#endif
+
 	return 0;
 }
-- 
2.8.2.401.g9c0faef

  reply	other threads:[~2016-05-17  3:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17  3:22 [RFD PATCH 0/3] Free all the memory! Stefan Beller
2016-05-17  3:22 ` Stefan Beller [this message]
2016-05-17  4:14   ` [PATCH 1/3] mv: free memory at the end if desired Torsten Bögershausen
2016-05-17  3:22 ` [PATCH 2/3] pack-redundant: free all memory Stefan Beller
2016-05-17  3:42   ` Eric Sunshine
2016-05-17  3:22 ` [PATCH 3/3] rev-parse: " Stefan Beller
2016-05-17  3:41 ` [RFD PATCH 0/3] Free all the memory! Eric Sunshine
2016-05-17 12:08   ` Eric Wong
2016-05-17 17:58   ` Stefan Beller
2016-05-17 18:16     ` Junio C Hamano
2016-05-17 18:20       ` Stefan Beller
2016-05-18  7:23     ` Eric Wong
2016-05-18 15:19     ` Ævar Arnfjörð Bjarmason
2016-05-17  5:46 ` David Turner
2016-05-17  9:05 ` Matthieu Moy

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=20160517032247.25092-2-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=stefanbeller@gmail.com \
    /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 NNTP newsgroup(s).