use xmallocz to avoid size arithmetic
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 0f7628db4d94c45cd26150f28d58903e26298e09..1d9e2a7932413a31fde81512ddcfdb7655209b1e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -124,7 +124,7 @@ int refname_is_safe(const char *refname)
                char *buf;
                int result;
 
-               buf = xmalloc(strlen(refname) + 1);
+               buf = xmallocz(strlen(refname));
                /*
                 * Does the refname try to escape refs/?
                 * For example: refs/foo/../bar is safe but refs/foo/../../bar
@@ -201,7 +201,7 @@ enum peel_status peel_object(const unsigned char *name, unsigned char *sha1)
        if (!o)
                return PEEL_INVALID;
 
-       hashcpy(sha1, o->sha1);
+       hashcpy(sha1, o->oid.hash);
        return PEEL_PEELED;
 }