tag: die when listing missing or corrupt objects
[gitweb.git] / builtin / tag.c
index 391160cf83338e1f18de5564cf1c0b2f78debefd..1e27f5c3d6ee9a5f6d4209cf048be5a66ca12125 100644 (file)
@@ -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");