mirror of
https://github.com/git/git
synced 2024-10-28 19:25:47 +00:00
Merge branch 'mt/dir-iterator-updates'
Leakfix. * mt/dir-iterator-updates: test-dir-iterator: use path argument directly dir-iterator: release strbuf after use
This commit is contained in:
commit
9179380aa6
2 changed files with 4 additions and 4 deletions
|
@ -2151,8 +2151,10 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
|
||||||
strbuf_addf(&sb, "%s/logs", gitdir);
|
strbuf_addf(&sb, "%s/logs", gitdir);
|
||||||
|
|
||||||
diter = dir_iterator_begin(sb.buf, 0);
|
diter = dir_iterator_begin(sb.buf, 0);
|
||||||
if(!diter)
|
if (!diter) {
|
||||||
|
strbuf_release(&sb);
|
||||||
return empty_ref_iterator_begin();
|
return empty_ref_iterator_begin();
|
||||||
|
}
|
||||||
|
|
||||||
iter = xcalloc(1, sizeof(*iter));
|
iter = xcalloc(1, sizeof(*iter));
|
||||||
ref_iterator = &iter->base;
|
ref_iterator = &iter->base;
|
||||||
|
|
|
@ -19,7 +19,6 @@ static const char *error_name(int error_number)
|
||||||
*/
|
*/
|
||||||
int cmd__dir_iterator(int argc, const char **argv)
|
int cmd__dir_iterator(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
struct strbuf path = STRBUF_INIT;
|
|
||||||
struct dir_iterator *diter;
|
struct dir_iterator *diter;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
int iter_status;
|
int iter_status;
|
||||||
|
@ -36,8 +35,7 @@ int cmd__dir_iterator(int argc, const char **argv)
|
||||||
if (!*argv || argc != 1)
|
if (!*argv || argc != 1)
|
||||||
die("dir-iterator needs exactly one non-option argument");
|
die("dir-iterator needs exactly one non-option argument");
|
||||||
|
|
||||||
strbuf_add(&path, *argv, strlen(*argv));
|
diter = dir_iterator_begin(*argv, flags);
|
||||||
diter = dir_iterator_begin(path.buf, flags);
|
|
||||||
|
|
||||||
if (!diter) {
|
if (!diter) {
|
||||||
printf("dir_iterator_begin failure: %s\n", error_name(errno));
|
printf("dir_iterator_begin failure: %s\n", error_name(errno));
|
||||||
|
|
Loading…
Reference in a new issue