diff options
author | Colin Walters <walters@verbum.org> | 2019-10-14 13:25:46 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2019-10-15 12:40:54 +0000 |
commit | aa7795d08d0d351a9117f2dc1c44f9f0ad568d05 (patch) | |
tree | 7e2b0ecfcd3ebd04fc70f21785ea5dc9f170e34e /src/libostree/ostree-repo-checkout.c | |
parent | aefa1ca249d47b178482add4d252d7fd4c44e489 (diff) | |
download | ostree-aa7795d08d0d351a9117f2dc1c44f9f0ad568d05.tar.gz |
libostree: Add an assert to pacify clang-analyzer
Got this error when trying to rebase libostree in RHEL:
```
Error: CLANG_WARNING: [#def1]
libostree-2019.2/src/libostree/ostree-repo-checkout.c:375:21: warning: Access to field 'disable_xattrs' results in a dereference of a null pointer (loaded from variable 'repo')
```
I think what's happening is it sees us effectively testing
`if (repo == NULL)` via the `while (current_repo)`. Let's
tell it we're sure it's non-null right after the loop.
Diffstat (limited to 'src/libostree/ostree-repo-checkout.c')
-rw-r--r-- | src/libostree/ostree-repo-checkout.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index 49ec995f..8dd14640 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -717,6 +717,8 @@ checkout_one_file_at (OstreeRepo *repo, } current_repo = current_repo->parent_repo; } + /* Pacify clang-analyzer which sees us testing effectively if (repo == NULL) */ + g_assert (repo); need_copy = (hardlink_res == HARDLINK_RESULT_NOT_SUPPORTED); } |