From: Tobias Stoeckmann Date: Wed, 4 Sep 2024 16:21:17 +0000 (+0200) Subject: libkmod: check for NULL in kmod_get_dirname X-Git-Tag: v34~454 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cb11a59e7529b9b1b9ba5b130abc52ed9f6eebe;p=thirdparty%2Fkmod.git libkmod: check for NULL in kmod_get_dirname The other KMOD_EXPORT'ed functions protect against ctx being NULL. Add this to kmod_get_dirname purely for consistency reasons. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/102 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index 61efe2d6..86025514 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -146,6 +146,9 @@ static void log_filep(void *data, */ KMOD_EXPORT const char *kmod_get_dirname(const struct kmod_ctx *ctx) { + if (ctx == NULL) + return NULL; + return ctx->dirname; }