builtin/: add UNLEAKs
Add some UNLEAKs where we are about to return from `cmd_*`. UNLEAK the variables in the same order as we've declared them. While addressing `msg` in builtin/tag.c, convert the existing `strbuf_release()` calls as well. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4010f1d1b7
commit
886e1084d7
@ -1291,6 +1291,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
|
|||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNLEAK(opts);
|
||||||
if (opts.patch_mode || opts.pathspec.nr)
|
if (opts.patch_mode || opts.pathspec.nr)
|
||||||
return checkout_paths(&opts, new.name);
|
return checkout_paths(&opts, new.name);
|
||||||
else
|
else
|
||||||
|
@ -57,5 +57,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
result = run_diff_index(&rev, cached);
|
result = run_diff_index(&rev, cached);
|
||||||
|
UNLEAK(rev);
|
||||||
return diff_result_code(&rev.diffopt, result);
|
return diff_result_code(&rev.diffopt, result);
|
||||||
}
|
}
|
||||||
|
@ -466,5 +466,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||||||
result = diff_result_code(&rev.diffopt, result);
|
result = diff_result_code(&rev.diffopt, result);
|
||||||
if (1 < rev.diffopt.skip_stat_unmatch)
|
if (1 < rev.diffopt.skip_stat_unmatch)
|
||||||
refresh_index_quietly();
|
refresh_index_quietly();
|
||||||
|
UNLEAK(rev);
|
||||||
|
UNLEAK(ent);
|
||||||
|
UNLEAK(blob);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -494,5 +494,6 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
|
|||||||
always, allow_undefined, data.name_only);
|
always, allow_undefined, data.name_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNLEAK(revs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -552,9 +552,10 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
|
|||||||
if (force && !is_null_oid(&prev) && oidcmp(&prev, &object))
|
if (force && !is_null_oid(&prev) && oidcmp(&prev, &object))
|
||||||
printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev.hash, DEFAULT_ABBREV));
|
printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev.hash, DEFAULT_ABBREV));
|
||||||
|
|
||||||
strbuf_release(&err);
|
UNLEAK(buf);
|
||||||
strbuf_release(&buf);
|
UNLEAK(ref);
|
||||||
strbuf_release(&ref);
|
UNLEAK(reflog_msg);
|
||||||
strbuf_release(&reflog_msg);
|
UNLEAK(msg);
|
||||||
|
UNLEAK(err);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user