Commit 52056db9 by Vicent Marti

Merge pull request #2250 from jacquesg/vector-leak

Don't lose our elements when calling git_vector_set()
parents 923c8400 4998009a
......@@ -327,8 +327,10 @@ int git_vector_resize_to(git_vector *v, size_t new_length)
int git_vector_set(void **old, git_vector *v, size_t position, void *value)
{
if (git_vector_resize_to(v, position + 1) < 0)
return -1;
if (position + 1 > v->length) {
if (git_vector_resize_to(v, position + 1) < 0)
return -1;
}
if (old != NULL)
*old = v->contents[position];
......
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