Skip to content

Commit 5261fef

Browse files
committed
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
2 parents 1f57e71 + 886e108 commit 5261fef

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

builtin/checkout.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
12971297
strbuf_release(&buf);
12981298
}
12991299

1300+
UNLEAK(opts);
13001301
if (opts.patch_mode || opts.pathspec.nr)
13011302
return checkout_paths(&opts, new.name);
13021303
else

builtin/diff-index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
5656
return -1;
5757
}
5858
result = run_diff_index(&rev, cached);
59+
UNLEAK(rev);
5960
return diff_result_code(&rev.diffopt, result);
6061
}

builtin/diff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,5 +464,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
464464
result = diff_result_code(&rev.diffopt, result);
465465
if (1 < rev.diffopt.skip_stat_unmatch)
466466
refresh_index_quietly();
467+
UNLEAK(rev);
468+
UNLEAK(ent);
469+
UNLEAK(blob);
467470
return result;
468471
}

builtin/name-rev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,5 +494,6 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
494494
always, allow_undefined, data.name_only);
495495
}
496496

497+
UNLEAK(revs);
497498
return 0;
498499
}

builtin/tag.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
552552
if (force && !is_null_oid(&prev) && oidcmp(&prev, &object))
553553
printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev.hash, DEFAULT_ABBREV));
554554

555-
strbuf_release(&err);
556-
strbuf_release(&buf);
557-
strbuf_release(&ref);
558-
strbuf_release(&reflog_msg);
555+
UNLEAK(buf);
556+
UNLEAK(ref);
557+
UNLEAK(reflog_msg);
558+
UNLEAK(msg);
559+
UNLEAK(err);
559560
return 0;
560561
}

0 commit comments

Comments
 (0)