Commit 629c0829 by Vicent Martí

Merge pull request #1082 from scunz/fixDoubleDeleteOnError

Indexer: Avoid a possible double-deletion in error case
parents 0066955d 4cc7342e
......@@ -249,8 +249,10 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
git_oid_cpy(&pentry->sha1, &oid);
pentry->offset = entry_start;
if (git_vector_insert(&idx->pack->cache, pentry) < 0)
if (git_vector_insert(&idx->pack->cache, pentry) < 0) {
git__free(pentry);
goto on_error;
}
git_oid_cpy(&entry->oid, &oid);
entry->crc = crc32(0L, Z_NULL, 0);
......@@ -275,7 +277,6 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
on_error:
git__free(entry);
git__free(pentry);
git__free(obj->data);
return -1;
}
......
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