refs: release strbuf on error return in write_pseudoref()
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index b0106b8162c7b8e3770e04c212abb05f1afbd0c3..d8dc86b1f5b08bb5d873a3eeb1fa3f927b18655e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -612,7 +612,7 @@ static int write_pseudoref(const char *pseudoref, const unsigned char *sha1,
        if (fd < 0) {
                strbuf_addf(err, "could not open '%s' for writing: %s",
                            filename, strerror(errno));
-               return -1;
+               goto done;
        }
 
        if (old_sha1) {