handle case where modname was not detected.

This commit is contained in:
Gustavo Sverzut Barbieri 2011-12-12 18:28:52 -02:00
parent cb451f35d9
commit 973c80ba7c
1 changed files with 4 additions and 1 deletions

View File

@ -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) {