Strbuf needs to be released even if it's locally declared.
Signed-off-by: Fredrik Gustafsson <[email protected]>
---
archive.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/archive.c b/archive.c
index 346f3b2..dfc557d 100644
--- a/archive.c
+++ b/archive.c
@@ -113,6 +113,7 @@ static int write_archive_entry(const unsigned char *sha1,
const char *base,
struct git_attr_check check[2];
const char *path_without_prefix;
int err;
+ int to_ret = 0;
args->convert = 0;
strbuf_reset(&path);
@@ -127,22 +128,25 @@ static int write_archive_entry(const unsigned char *sha1,
const char *base,
setup_archive_check(check);
if (!git_check_attr(path_without_prefix, ARRAY_SIZE(check), check)) {
if (ATTR_TRUE(check[0].value))
- return 0;
+ goto cleanup;
args->convert = ATTR_TRUE(check[1].value);
}
if (S_ISDIR(mode) || S_ISGITLINK(mode)) {
if (args->verbose)
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
- err = write_entry(args, sha1, path.buf, path.len, mode);
- if (err)
- return err;
- return (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
+ to_ret = write_entry(args, sha1, path.buf, path.len, mode);
+ if (!to_ret)
+ to_ret = (S_ISDIR(mode) ? READ_TREE_RECURSIVE : 0);
+ goto cleanup;
}
if (args->verbose)
fprintf(stderr, "%.*s\n", (int)path.len, path.buf);
- return write_entry(args, sha1, path.buf, path.len, mode);
+ to_ret = write_entry(args, sha1, path.buf, path.len, mode);
+cleanup:
+ strbuf_release(&path);
+ return to_ret;
}
int write_archive_entries(struct archiver_args *args,
--
1.8.3.1.490.g39d9b24.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html