diff options
author | Russell Belfer <rb@github.com> | 2014-04-21 11:55:57 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-21 11:55:57 -0700 |
commit | 17ef678ca543d8b56035e36039ee319c12d0d249 (patch) | |
tree | ea7fa695cc304b9f4ee5f9b6f73a8b5a68c9e10a /src/attr_file.c | |
parent | 28750a7d98ce5e23bac5c1d119109ded8e8aab73 (diff) | |
download | libgit2-17ef678ca543d8b56035e36039ee319c12d0d249.tar.gz |
Fix some coverity-found issues
Diffstat (limited to 'src/attr_file.c')
-rw-r--r-- | src/attr_file.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index d107b5ab0..156a23d91 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -232,15 +232,14 @@ int git_attr_file__parse_buffer( while (!error && *scan) { /* allocate rule if needed */ - if (!rule) { - if (!(rule = git__calloc(1, sizeof(*rule)))) { - error = -1; - break; - } - rule->match.flags = GIT_ATTR_FNMATCH_ALLOWNEG | - GIT_ATTR_FNMATCH_ALLOWMACRO; + if (!rule && !(rule = git__calloc(1, sizeof(*rule)))) { + error = -1; + break; } + rule->match.flags = + GIT_ATTR_FNMATCH_ALLOWNEG | GIT_ATTR_FNMATCH_ALLOWMACRO; + /* parse the next "pattern attr attr attr" line */ if (!(error = git_attr_fnmatch__parse( &rule->match, &attrs->pool, context, &scan)) && |