this patch fixes a common and a rare memory leak in read-cache.c.

        Ingo

Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>

--- read-cache.c.orig
+++ read-cache.c
@@ -226,8 +226,11 @@ int write_sha1_file(char *buf, unsigned 
        SHA1_Update(&c, compressed, size);
        SHA1_Final(sha1, &c);
 
-       if (write_sha1_buffer(sha1, compressed, size) < 0)
+       if (write_sha1_buffer(sha1, compressed, size) < 0) {
+               free(compressed);
                return -1;
+       }
+       free(compressed);
        if (returnsha1)
                memcpy(returnsha1, sha1, 20);
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to