Don't leak file descriptors from unavailable pack files.
[gitweb.git] / builtin-fmt-merge-msg.c
index 3d3097d299d4c964e1acfff7a365501a8bd53587..87d3d63ec71ec7f08127085330d28ed28e3f35c7 100644 (file)
@@ -278,6 +278,8 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
 
        /* get current branch */
        current_branch = resolve_ref("HEAD", head_sha1, 1, NULL);
+       if (!current_branch)
+               die("No current branch");
        if (!strncmp(current_branch, "refs/heads/", 11))
                current_branch += 11;