Merge branch 'jk/command-line-config-empty-string'
[gitweb.git] / sha1_name.c
index 6ccd3a53f8fc6130000c4bf3ba4cd646f512de53..63ee66fedd617e2cacfae7a763f43ee600d15273 100644 (file)
@@ -540,8 +540,10 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                        char *tmp = xstrndup(str + at + 2, reflog_len);
                        at_time = approxidate_careful(tmp, &errors);
                        free(tmp);
-                       if (errors)
+                       if (errors) {
+                               free(real_ref);
                                return -1;
+                       }
                }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {