chiark / gitweb /
use new git-check-ref-format
[version-charset-test.git] / 0003-check-ref-format-Abolish-leak-of-collapsed-refname.patch
diff --git a/0003-check-ref-format-Abolish-leak-of-collapsed-refname.patch b/0003-check-ref-format-Abolish-leak-of-collapsed-refname.patch
new file mode 100644 (file)
index 0000000..2bf945d
--- /dev/null
@@ -0,0 +1,34 @@
+From 983c936a996dba2da91358be7e0b1e2a4481741a Mon Sep 17 00:00:00 2001
+From: Ian Jackson <ijackson@chiark.greenend.org.uk>
+Date: Fri, 4 Nov 2016 17:26:18 +0000
+Subject: [PATCH 3/5] check-ref-format: Abolish leak of collapsed refname
+
+collapse_slashes always returns a value from xmallocz.
+
+Right now this leak is not very interesting, since we only call
+check_one_ref_format once.
+
+Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
+---
+ builtin/check-ref-format.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
+index f12c19c..020ebe8 100644
+--- a/builtin/check-ref-format.c
++++ b/builtin/check-ref-format.c
+@@ -63,8 +63,10 @@ static int check_one_ref_format(const char *refname)
+               : check_refname_format(refname, flags);
+       if (got)
+               return 1;
+-      if (normalize)
++      if (normalize) {
+               printf("%s\n", refname);
++              free((void*)refname);
++      }
+ }
+ int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
+-- 
+2.10.1
+