Message ID | 1381182185-10896-9-git-send-email-zab@redhat.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Monday 07 Oct 2013 2:43:01 PM you wrote: > This was found by static analysis. > > Signed-off-by: Zach Brown <zab@redhat.com> > --- > cmds-check.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/cmds-check.c b/cmds-check.c > index ebba58e..b6035d7 100644 > --- a/cmds-check.c > +++ b/cmds-check.c > @@ -3228,13 +3228,13 @@ static int verify_space_cache(struct btrfs_root *root, > > ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); > if (ret < 0) > - return ret; > + goto out; > ret = 0; > while (1) { > if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { > ret = btrfs_next_leaf(root, path); > if (ret < 0) > - return ret; > + goto out; > if (ret > 0) { > ret = 0; > break; > @@ -3274,6 +3274,8 @@ static int verify_space_cache(struct btrfs_root *root, > ret = check_cache_range(root, cache, last, > cache->key.objectid + > cache->key.offset - last); > + > +out: > btrfs_free_path(path); > > if (!ret && > This has been fixed by commit 7ae60bf1. But I feel that your fix is better since the clean up code is segregated to one place and hence we have fewer places in the function where we return from. Reviewed-by: chandan <chandan@linux.vnet.ibm.com> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-check.c b/cmds-check.c index ebba58e..b6035d7 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3228,13 +3228,13 @@ static int verify_space_cache(struct btrfs_root *root, ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); if (ret < 0) - return ret; + goto out; ret = 0; while (1) { if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { ret = btrfs_next_leaf(root, path); if (ret < 0) - return ret; + goto out; if (ret > 0) { ret = 0; break; @@ -3274,6 +3274,8 @@ static int verify_space_cache(struct btrfs_root *root, ret = check_cache_range(root, cache, last, cache->key.objectid + cache->key.offset - last); + +out: btrfs_free_path(path); if (!ret &&
This was found by static analysis. Signed-off-by: Zach Brown <zab@redhat.com> --- cmds-check.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)