diff options
| author | Russell Belfer <rb@github.com> | 2012-05-04 11:06:12 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-05-04 11:06:12 -0700 |
| commit | b709e95146b9d56e2c009915ccea7a86c77d4202 (patch) | |
| tree | c9257b8278c8d1e28b0cfe5969317ef0ed63c315 /src/attr.c | |
| parent | f917481ee84cbba481c1854cccdedb2d98377d43 (diff) | |
| download | libgit2-b709e95146b9d56e2c009915ccea7a86c77d4202.tar.gz | |
Fix memory leaks and use after free
Diffstat (limited to 'src/attr.c')
| -rw-r--r-- | src/attr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/attr.c b/src/attr.c index 56d04d3a9..b7ac6355d 100644 --- a/src/attr.c +++ b/src/attr.c @@ -334,8 +334,6 @@ int git_attr_cache__push_file( } /* if not in cache, load data, parse, and cache */ - if (git_attr_file__new(&file, source, relfile, &cache->pool) < 0) - return -1; if (source == GIT_ATTR_FILE_FROM_FILE) error = load_attr_file(filename, &content); @@ -354,6 +352,9 @@ int git_attr_cache__push_file( if (blob) content = git_blob_rawcontent(blob); + if ((error = git_attr_file__new(&file, source, relfile, &cache->pool)) < 0) + goto finish; + if (parse && (error = parse(repo, content, file)) < 0) goto finish; |
