git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builtin-update-index.c (add_file_to_cache): Don't leak a cache entry.
@ 2007-02-16  9:01 Jim Meyering
  2007-02-16 17:00 ` Linus Torvalds
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Meyering @ 2007-02-16  9:01 UTC (permalink / raw)
  To: git


Signed-off-by: Jim Meyering <jim@meyering.net>
---
 builtin-update-index.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/builtin-update-index.c b/builtin-update-index.c
index 1ac613a..5b2278e 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -121,8 +121,10 @@ static int add_file_to_cache(const char *path)
 			ce->ce_mode = create_ce_mode(S_IFREG | 0666);
 	}

-	if (index_path(ce->sha1, path, &st, !info_only))
+	if (index_path(ce->sha1, path, &st, !info_only)) {
+		free(ce);
 		return -1;
+	}
 	option = allow_add ? ADD_CACHE_OK_TO_ADD : 0;
 	option |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;
 	if (add_cache_entry(ce, option))
--
1.5.0.33.gaf997-dirty

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

end of thread, other threads:[~2007-02-18  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-16  9:01 [PATCH] builtin-update-index.c (add_file_to_cache): Don't leak a cache entry Jim Meyering
2007-02-16 17:00 ` Linus Torvalds
2007-02-18  9:10   ` Jim Meyering

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