summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-10-07 16:27:55 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-10-07 16:27:55 +0900
commit5261fefa4aa7e9c054e1bd664a138d49a3e26d79 (patch)
treea56d45f14a526fa1bf1da76aa447ed86e1c85a3f
parentMerge branch 'rb/compat-poll-fix' (diff)
parentbuiltin/: add UNLEAKs (diff)
downloadtgif-5261fefa4aa7e9c054e1bd664a138d49a3e26d79.tar.xz
Merge branch 'ma/builtin-unleak'
Many variables that points at a region of memory that will live throughout the life of the program have been marked with UNLEAK marker to help the leak checkers concentrate on real leaks.. * ma/builtin-unleak: builtin/: add UNLEAKs
-rw-r--r--builtin/checkout.c1
-rw-r--r--builtin/diff-index.c1
-rw-r--r--builtin/diff.c3
-rw-r--r--builtin/name-rev.c1
-rw-r--r--builtin/tag.c9
5 files changed, 11 insertions, 4 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 10751585ea..fc4f8fd2ea 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1297,6 +1297,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
strbuf_release(&buf);
}
+ UNLEAK(opts);
if (opts.patch_mode || opts.pathspec.nr)
return checkout_paths(&opts, new.name);
else
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 9d772f8f27..522f4fdffd 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -56,5 +56,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
return -1;
}
result = run_diff_index(&rev, cached);
+ UNLEAK(rev);
return diff_result_code(&rev.diffopt, result);
}
diff --git a/builtin/diff.c b/builtin/diff.c
index 7e3ebcea38..f5bbd4d757 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -464,5 +464,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
result = diff_result_code(&rev.diffopt, result);
if (1 < rev.diffopt.skip_stat_unmatch)
refresh_index_quietly();
+ UNLEAK(rev);
+ UNLEAK(ent);
+ UNLEAK(blob);
return result;
}
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 598da6c8bc..9e088ebd11 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -494,5 +494,6 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
always, allow_undefined, data.name_only);
}
+ UNLEAK(revs);
return 0;
}
diff --git a/builtin/tag.c b/builtin/tag.c
index c627794181..34efba5798 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -552,9 +552,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (force && !is_null_oid(&prev) && oidcmp(&prev, &object))
printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev.hash, DEFAULT_ABBREV));
- strbuf_release(&err);
- strbuf_release(&buf);
- strbuf_release(&ref);
- strbuf_release(&reflog_msg);
+ UNLEAK(buf);
+ UNLEAK(ref);
+ UNLEAK(reflog_msg);
+ UNLEAK(msg);
+ UNLEAK(err);
return 0;
}