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