diff options
author | Colin Walters <walters@verbum.org> | 2021-10-08 09:10:59 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2021-10-13 17:13:14 -0400 |
commit | 54bf42c3e5f6603031f55f5e2187adb3c4f5c5da (patch) | |
tree | 195b6b8581a70da169a5ae22386ead2875c98e2e | |
parent | f355482e1f82ee26ba0f202ff6c05b1b14ddc858 (diff) | |
download | ostree-54bf42c3e5f6603031f55f5e2187adb3c4f5c5da.tar.gz |
utils: Fix unreachable `NULL` deref by adding assertion
Again this one is just in theory, but let's add an assertion.
-rw-r--r-- | src/libotutil/ot-gio-utils.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c index f09ee8af..9ee6f7d5 100644 --- a/src/libotutil/ot-gio-utils.c +++ b/src/libotutil/ot-gio-utils.c @@ -82,10 +82,13 @@ ot_gfile_ensure_unlinked (GFile *path, GCancellable *cancellable, GError **error) { - if (unlink (gs_file_get_path_cached (path)) != 0) + g_assert (path); + const char *pathc = gs_file_get_path_cached (path); + g_assert (pathc); + if (unlink (pathc) != 0) { if (errno != ENOENT) - return glnx_throw_errno_prefix (error, "unlink(%s)", gs_file_get_path_cached (path)); + return glnx_throw_errno_prefix (error, "unlink(%s)", pathc); } return TRUE; } |