diff options
| author | Etienne Samson <samson.etienne@gmail.com> | 2018-09-26 21:17:39 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2018-10-26 14:58:51 +0200 |
| commit | b133ab9be9b8314e48585e5026698cd8a533bbcd (patch) | |
| tree | 0540846e3f7ee52f455e97cc602776457c098a97 | |
| parent | ebb0e37ea69c9009c239b7b6d378f57c7802e012 (diff) | |
| download | libgit2-b133ab9be9b8314e48585e5026698cd8a533bbcd.tar.gz | |
vector: do not realloc 0-size vectors
(cherry picked from commit e0afd1c21c4421cec4f67162021f835e2bbb7df6)
| -rw-r--r-- | src/vector.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vector.c b/src/vector.c index aac4863d4..98aa7bb2f 100644 --- a/src/vector.c +++ b/src/vector.c @@ -32,6 +32,9 @@ GIT_INLINE(int) resize_vector(git_vector *v, size_t new_size) { void *new_contents; + if (new_size == 0) + return 0; + new_contents = git__reallocarray(v->contents, new_size, sizeof(void *)); GITERR_CHECK_ALLOC(new_contents); |
