summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-06-07 10:05:54 +0200
committerPatrick Steinhardt <ps@pks.im>2017-06-08 11:58:22 +0200
commit97eb5ef0262bc0acf2ce66481105960b79e10ed7 (patch)
tree3dfdecd584ce89688d2b5b617dc36d4dc3033223
parentdd0aa811dd329f5040c70f7aac514b3757eb2453 (diff)
downloadlibgit2-97eb5ef0262bc0acf2ce66481105960b79e10ed7.tar.gz
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.
-rw-r--r--src/pack.c1
-rw-r--r--src/transports/winhttp.c1
2 files changed, 0 insertions, 2 deletions
diff --git a/src/pack.c b/src/pack.c
index 60b757e90..d24c13815 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -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_puts(&idx_name, ".idx");
if (git_buf_oom(&idx_name)) {
- giterr_set_oom();
return -1;
}
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index e8e848026..fb504c912 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -429,7 +429,6 @@ static int winhttp_stream_connect(winhttp_stream *s)
git_buf_printf(&processed_url, ":%s", t->proxy_connection_data.port);
if (git_buf_oom(&processed_url)) {
- giterr_set_oom();
error = -1;
goto on_error;
}