summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-12 11:50:27 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-08-12 11:50:27 +0200
commite54cfb9b544eeac2924f45fc7752c2a7be709a03 (patch)
tree159b376f5ca1c53eccd90b73c321a000a0941e0c /src
parent8ca093991d3105e62a6f509e9763c1f72040e1c7 (diff)
downloadlibgit2-e54cfb9b544eeac2924f45fc7752c2a7be709a03.tar.gz
odb: free object data when id is ambiguous
By the time we recognise this as an ambiguous id, the object's data has been loaded into memory. Free it when returning EABMIGUOUS.
Diffstat (limited to 'src')
-rw-r--r--src/odb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/odb.c b/src/odb.c
index 23eb4e12e..6969cf772 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -786,8 +786,10 @@ attempt_lookup:
git__free(data);
data = raw.data;
- if (found && git_oid__cmp(&full_oid, &found_full_oid))
+ if (found && git_oid__cmp(&full_oid, &found_full_oid)) {
+ git__free(raw.data);
return git_odb__error_ambiguous("multiple matches for prefix");
+ }
found_full_oid = full_oid;
found = true;