Skip to content

Commit 97eb5ef

Browse files
committed
buffer: rely on GITERR_OOM set by git_buf_try_grow
The function `git_buf_try_grow` consistently calls `giterr_set_oom` whenever growing the buffer fails due to insufficient memory being available. So in fact, we do not have to do this ourselves when a call to any buffer-growing function has failed due to an OOM situation. But we still do so in two functions, which this patch cleans up.
1 parent dd0aa81 commit 97eb5ef

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

src/pack.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ static int pack_index_open(struct git_pack_file *p)
324324
git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
325325
git_buf_puts(&idx_name, ".idx");
326326
if (git_buf_oom(&idx_name)) {
327-
giterr_set_oom();
328327
return -1;
329328
}
330329

src/transports/winhttp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ static int winhttp_stream_connect(winhttp_stream *s)
429429
git_buf_printf(&processed_url, ":%s", t->proxy_connection_data.port);
430430

431431
if (git_buf_oom(&processed_url)) {
432-
giterr_set_oom();
433432
error = -1;
434433
goto on_error;
435434
}

0 commit comments

Comments
 (0)