mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 20:08:50 +00:00
filter: close the descriptor in case of error
When we hit an error writing to the next stream from a file, we jump to 'done' which currently skips over closing the file descriptor. Make sure to close the descriptor if it has been set to a valid value.
This commit is contained in:
parent
969d4b703c
commit
0137aba568
@ -887,7 +887,7 @@ int git_filter_list_stream_file(
|
||||
git_vector filter_streams = GIT_VECTOR_INIT;
|
||||
git_writestream *stream_start;
|
||||
ssize_t readlen;
|
||||
int fd, error;
|
||||
int fd = -1, error;
|
||||
|
||||
if ((error = stream_list_init(
|
||||
&stream_start, &filter_streams, filters, target)) < 0 ||
|
||||
@ -909,9 +909,10 @@ int git_filter_list_stream_file(
|
||||
else if (readlen < 0)
|
||||
error = readlen;
|
||||
|
||||
p_close(fd);
|
||||
|
||||
done:
|
||||
if (fd >= 0)
|
||||
p_close(fd);
|
||||
stream_list_free(&filter_streams);
|
||||
git_buf_free(&abspath);
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user