Commit 97eb5ef0 by Patrick Steinhardt

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.
parent dd0aa811
...@@ -324,7 +324,6 @@ static int pack_index_open(struct git_pack_file *p) ...@@ -324,7 +324,6 @@ static int pack_index_open(struct git_pack_file *p)
git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack")); git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
git_buf_puts(&idx_name, ".idx"); git_buf_puts(&idx_name, ".idx");
if (git_buf_oom(&idx_name)) { if (git_buf_oom(&idx_name)) {
giterr_set_oom();
return -1; return -1;
} }
......
...@@ -429,7 +429,6 @@ static int winhttp_stream_connect(winhttp_stream *s) ...@@ -429,7 +429,6 @@ static int winhttp_stream_connect(winhttp_stream *s)
git_buf_printf(&processed_url, ":%s", t->proxy_connection_data.port); git_buf_printf(&processed_url, ":%s", t->proxy_connection_data.port);
if (git_buf_oom(&processed_url)) { if (git_buf_oom(&processed_url)) {
giterr_set_oom();
error = -1; error = -1;
goto on_error; goto on_error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment