X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tag.c;h=f62bcdd994509323080683ce19c1a4d8241f9dec;hb=694a577519a762d12b8a53e76b6f1dd3ccf25e7d;hp=330d287924765c95dac428f040b104930c316b81;hpb=3545193735522f733fdb4e345f16ddf131e2007a;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;