[PATCH] builtin-update-index.c (add_file_to_cache): Don't leak a cache entry.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jim Meyering <jim@xxxxxxxxxxxx>
---
 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]