registry: check the value of dladdr()

info.dli_fname could be NULL.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/994

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1659>
This commit is contained in:
Matthew Waters 2022-02-07 16:36:13 +11:00 committed by GStreamer Marge Bot
parent 69eeb854ea
commit 81a0e92d9b

View file

@ -1573,9 +1573,19 @@ priv_gst_get_relocated_libgstreamer (void)
{ {
Dl_info info; Dl_info info;
GST_DEBUG ("attempting to retrieve libgstreamer-1.0 location using "
"dladdr()");
if (dladdr (&gst_init, &info)) { if (dladdr (&gst_init, &info)) {
GST_LOG ("dli_fname: %s", info.dli_fname);
if (!info.dli_fname) {
return NULL;
}
dir = g_path_get_dirname (info.dli_fname); dir = g_path_get_dirname (info.dli_fname);
} else { } else {
GST_LOG ("dladdr() failed");
return NULL; return NULL;
} }
} }