textconv: stop leaking file descriptors
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 387d19fdedef650516ea9fd7679f48e3776a7616..69147b802f73203ab27352ac1b3513138fa50417 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3485,11 +3485,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);
                if (temp.name == temp.tmp_path)
                        unlink(temp.name);
                error("error running textconv command '%s'", pgm);
                return NULL;
        }
+       close(child.out);
        if (temp.name == temp.tmp_path)
                unlink(temp.name);