mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 15:20:11 +01:00
libnm/tests: avoid Coverity warning in test code _do_test_utils_str_utf8safe_unescape()
Error: FORWARD_NULL (CWE-476): [#def435]
NetworkManager-1.31.5/src/libnm-core-impl/tests/test-general.c:9084: var_compare_op: Comparing "str" to null implies that "str" might be null.
NetworkManager-1.31.5/src/libnm-core-impl/tests/test-general.c:9105: var_deref_model: Passing null pointer "str" to "strchr", which dereferences it.
# 9103| s = nm_utils_str_utf8safe_unescape(str, NM_UTILS_STR_UTF8_SAFE_FLAG_NONE, &str_free_1);
# 9104| g_assert_cmpstr(s, ==, expected);
# 9105|-> if (strchr(str, '\\')) {
# 9106| g_assert(str_free_1 != str);
# 9107| g_assert(s == str_free_1);
This commit is contained in:
parent
6646ee6546
commit
a559950d41
1 changed files with 1 additions and 0 deletions
|
|
@ -9102,6 +9102,7 @@ _do_test_utils_str_utf8safe_unescape(const char *str, const char *expected, gsiz
|
|||
/* there are no embedded NULs. Check that nm_utils_str_utf8safe_unescape() yields the same result. */
|
||||
s = nm_utils_str_utf8safe_unescape(str, NM_UTILS_STR_UTF8_SAFE_FLAG_NONE, &str_free_1);
|
||||
g_assert_cmpstr(s, ==, expected);
|
||||
g_assert(str);
|
||||
if (strchr(str, '\\')) {
|
||||
g_assert(str_free_1 != str);
|
||||
g_assert(s == str_free_1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue