status: introduce status.branch to enable --branch by default
[gitweb.git] / builtin / receive-pack.c
index ccebd74f166f5d02e8e6a0bb6033d741f8580f7b..e3eb5fc0588a79b2b6c29bccdaf71ba49dc14c1f 100644 (file)
@@ -826,8 +826,11 @@ static const char *unpack(int err_fd)
                            : 0);
 
        hdr_err = parse_pack_header(&hdr);
-       if (hdr_err)
+       if (hdr_err) {
+               if (err_fd > 0)
+                       close(err_fd);
                return hdr_err;
+       }
        snprintf(hdr_arg, sizeof(hdr_arg),
                        "--pack_header=%"PRIu32",%"PRIu32,
                        ntohl(hdr.hdr_version), ntohl(hdr.hdr_entries));