Commit f93f8ec5 by Jakob Pfender Committed by Vicent Marti

odb_loose.c: Return GIT_ENOMEM when allocation fails

When trying to inflate a buffer, a GIT_ERROR was returned when malloc()
failed.

Fix this to return GIT_ENOMEM.
parent 1e85d1aa
...@@ -315,7 +315,7 @@ static int inflate_packlike_loose_disk_obj(git_rawobj *out, gitfo_buf *obj) ...@@ -315,7 +315,7 @@ static int inflate_packlike_loose_disk_obj(git_rawobj *out, gitfo_buf *obj)
*/ */
buf = git__malloc(hdr.size + 1); buf = git__malloc(hdr.size + 1);
if (!buf) if (!buf)
return GIT_ERROR; return GIT_ENOMEM;
in = ((unsigned char *)obj->data) + used; in = ((unsigned char *)obj->data) + used;
len = obj->len - used; len = obj->len - used;
...@@ -363,7 +363,7 @@ static int inflate_disk_obj(git_rawobj *out, gitfo_buf *obj) ...@@ -363,7 +363,7 @@ static int inflate_disk_obj(git_rawobj *out, gitfo_buf *obj)
* (including the initial sequence in the head buffer). * (including the initial sequence in the head buffer).
*/ */
if ((buf = inflate_tail(&zs, head, used, &hdr)) == NULL) if ((buf = inflate_tail(&zs, head, used, &hdr)) == NULL)
return GIT_ERROR; return GIT_ENOMEM;
buf[hdr.size] = '\0'; buf[hdr.size] = '\0';
out->data = buf; out->data = buf;
......
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