Index: uspace/lib/c/generic/rtld/module.c
===================================================================
--- uspace/lib/c/generic/rtld/module.c	(revision 8aea932685c5efe502aa73a5118f0e8c4eb3e36c)
+++ uspace/lib/c/generic/rtld/module.c	(revision 0aa5c8af700fa91934c238aa068015b564acb24f)
@@ -302,4 +302,8 @@
 			if (!dm) {
 				dm = module_load(m->rtld, dep_name, flags);
+				if (!dm) {
+					return EINVAL;
+				}
+
 				errno_t rc = module_load_deps(dm, flags);
 				if (rc != EOK) {
