]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ma/builtin-unleak'
authorJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:55 +0000 (16:27 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:55 +0000 (16:27 +0900)
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

builtin/checkout.c
builtin/diff-index.c
builtin/diff.c
builtin/name-rev.c
builtin/tag.c

index 10751585ea38c282d439e4128c895c01a2598985..fc4f8fd2ea29c7c23d3b1c7ca0ba78824c255a91 100644 (file)
@@ -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
index 9d772f8f27fe722921c00ea57af1087f988856da..522f4fdffd064de2e50232934cb7d616246c92e4 100644 (file)
@@ -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);
 }
index 7e3ebcea38f1485f4c7fb5f5af6494ceb81f5cbb..f5bbd4d757e12e6e34a86fac006298acb771909f 100644 (file)
@@ -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;
 }
index 598da6c8bc75e9de50f85eac78d3051f27f96a6c..9e088ebd11dced248640df9e17adbbd8b9a73ffb 100644 (file)
@@ -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;
 }
index c627794181f55d293719e5369d74bb9b598f5450..34efba5798e226f684906af74ebbc104e8401f39 100644 (file)
@@ -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;
 }