X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=tag.c;h=f62bcdd994509323080683ce19c1a4d8241f9dec;hb=cb1491b6bff20748532c9e50afc7f9d6896167a8;hp=330d287924765c95dac428f040b104930c316b81;hpb=d6b3e3a33f71910526ccf80af6c13a230363cd89;p=git.git diff --git a/tag.c b/tag.c index 330d28792..f62bcdd99 100644 --- a/tag.c +++ b/tag.c @@ -26,7 +26,7 @@ struct tag *lookup_tag(const unsigned char *sha1) if (!obj->type) obj->type = OBJ_TAG; if (obj->type != OBJ_TAG) { - error("Object %s is a %s, not a tree", + error("Object %s is a %s, not a tag", sha1_to_hex(sha1), typename(obj->type)); return NULL; } @@ -68,9 +68,7 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size) memcpy(type, type_line + 5, typelen); type[typelen] = '\0'; taglen = sig_line - tag_line - strlen("tag \n"); - item->tag = xmalloc(taglen + 1); - memcpy(item->tag, tag_line + 4, taglen); - item->tag[taglen] = '\0'; + item->tag = xmemdupz(tag_line + 4, taglen); if (!strcmp(type, blob_type)) { item->tagged = &lookup_blob(sha1)->object;