send-pack: avoid deadlock on git:// push with failed pack-objects
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 08bbd3e9070996b38f4d34cedf7640d93aa5808d..6da52e0c49bc5646594ab47cba3971fd156e021d 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3776,11 +3776,13 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
        if (start_command(&child) != 0 ||
            strbuf_read(&buf, child.out, 0) < 0 ||
            finish_command(&child) != 0) {
+               close(child.out);
                strbuf_release(&buf);
                remove_tempfile();
                error("error running textconv command '%s'", pgm);
                return NULL;
        }
+       close(child.out);
        remove_tempfile();
 
        return strbuf_detach(&buf, outsize);