rtld: Fix null-pointer dereference
Approved by: re (gjb)
(cherry picked from commit 43d44842aef3972cc86ce673e84e31f372257b15)