line-log.c: prevent crash during union of too many ranges
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index b4e7cac7b26d0903c4ab7361430c38232c1d5e82..62055ab09103acd8301ce8c70e7d903da3fc9439 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -791,8 +791,7 @@ struct ref_update *ref_transaction_add_update(
                hashcpy(update->new_sha1, new_sha1);
        if (flags & REF_HAVE_OLD)
                hashcpy(update->old_sha1, old_sha1);
-       if (msg)
-               update->msg = xstrdup(msg);
+       update->msg = xstrdup_or_null(msg);
        return update;
 }