Code

git-sh-setup: make require_clean_work_tree part of the interface
[git.git] / read-cache.c
index 309b77a6c9bae41ba2cde42e0266b02ae4b32497..1f42473e8070a05ada8c56b0d60537227a5223ec 100644 (file)
@@ -26,7 +26,7 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall
 
 #define CACHE_EXT(s) ( (s[0]<<24)|(s[1]<<16)|(s[2]<<8)|(s[3]) )
 #define CACHE_EXT_TREE 0x54524545      /* "TREE" */
-#define CACHE_EXT_RESOLVE_UNDO 0x52455543 /* "REUN" */
+#define CACHE_EXT_RESOLVE_UNDO 0x52455543 /* "REUC" */
 
 struct index_state the_index;
 
@@ -1516,6 +1516,7 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce)
        int size = ondisk_ce_size(ce);
        struct ondisk_cache_entry *ondisk = xcalloc(1, size);
        char *name;
+       int result;
 
        ondisk->ctime.sec = htonl(ce->ce_ctime.sec);
        ondisk->mtime.sec = htonl(ce->ce_mtime.sec);
@@ -1539,7 +1540,9 @@ static int ce_write_entry(git_SHA_CTX *c, int fd, struct cache_entry *ce)
                name = ondisk->name;
        memcpy(name, ce->name, ce_namelen(ce));
 
-       return ce_write(c, fd, ondisk, size);
+       result = ce_write(c, fd, ondisk, size);
+       free(ondisk);
+       return result;
 }
 
 int write_index(struct index_state *istate, int newfd)