summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-04-22 18:47:18 +0200
committerThomas Haller <thaller@redhat.com>2022-04-22 19:04:19 +0200
commit31380f8b93ce3390e3aa32d593d56b0d05b3f73a (patch)
treea9b4768f9989547167a2b456d0f5b49c1975d383 /src
parentaa398b5fdaa27678069ea7b4a322b14281075db4 (diff)
downloadlibnl-31380f8b93ce3390e3aa32d593d56b0d05b3f73a.tar.gz
utils: suppress coverity warning in nl_cli_load_module() about leaked handle
It's unclear to me, how to avoid this "leak". It's intentional, given the existing API. Try to suppress the warning. Error: RESOURCE_LEAK (CWE-772): libnl-3.6.0/src/lib/utils.c:232: alloc_fn: Storage is returned from allocation function "dlopen". libnl-3.6.0/src/lib/utils.c:232: var_assign: Assigning: "handle" = storage returned from "dlopen(path, 2)". libnl-3.6.0/src/lib/utils.c:236: leaked_storage: Variable "handle" going out of scope leaks the storage it points to. # 234| path, dlerror()); # 235| } # 236|-> } # 237| #else # 238| nl_cli_fatal(ENOTSUP, "Unable to load module \"%s\": built without dynamic libraries support\n",
Diffstat (limited to 'src')
-rw-r--r--src/lib/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/utils.c b/src/lib/utils.c
index 2dc77831..cbcdafe9 100644
--- a/src/lib/utils.c
+++ b/src/lib/utils.c
@@ -234,6 +234,8 @@ void nl_cli_load_module(const char *prefix, const char *name)
nl_cli_fatal(ENOENT, "Unable to load module \"%s\": %s\n",
path, dlerror());
}
+ /* We intentionally leak the dlopen handle. */
+ /* coverity[RESOURCE_LEAK] */
}
#else
nl_cli_fatal(ENOTSUP, "Unable to load module \"%s\": built without dynamic libraries support\n",