handle case where modname was not detected.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Mon, 12 Dec 2011 20:28:52 +0000 (18:28 -0200)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Mon, 12 Dec 2011 20:28:52 +0000 (18:28 -0200)
libkmod/libkmod-module.c

index ee1be6d..1e14191 100644 (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) {