From 973c80ba7c4e38f1d4fb54ae9258b1977b3c3f12 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Mon, 12 Dec 2011 18:28:52 -0200 Subject: [PATCH] handle case where modname was not detected. --- libkmod/libkmod-module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index ee1be6d..1e14191 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -248,7 +248,10 @@ KMOD_EXPORT int kmod_module_new_from_path(struct kmod_ctx *ctx, return -errno; } - path_to_modname(path, name, &namelen); + if (path_to_modname(path, name, &namelen) == NULL) { + free(abspath); + return -ENOENT; + } m = kmod_pool_get_module(ctx, name); if (m != NULL) { -- 2.7.4