summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/tag.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index 391160cf83..1e27f5c3d6 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -93,8 +93,12 @@ static void show_tag_lines(const unsigned char *sha1, int lines)
size_t len;
buf = read_sha1_file(sha1, &type, &size);
- if (!buf || !size)
+ if (!buf)
+ die_errno("unable to read object %s", sha1_to_hex(sha1));
+ if (!size) {
+ free(buf);
return;
+ }
/* skip header */
sp = strstr(buf, "\n\n");