[patch] git: fix memory leak #2 in checkout-cache.c
[gitweb.git] / checkout-cache.c
index 64ce92147fdf200798be2578ddb051f9115a7ba5..b561ef487ee093207ba2034e1142614276d1e5a9 100644 (file)
@@ -77,6 +77,8 @@ static int write_entry(struct cache_entry *ce, const char *path)
 
        new = read_sha1_file(ce->sha1, type, &size);
        if (!new || strcmp(type, "blob")) {
+               if (new)
+                       free(new);
                return error("checkout-cache: unable to read sha1 file of %s (%s)",
                        path, sha1_to_hex(ce->sha1));
        }