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/1644>
This commit is contained in:
Matthew Waters 2022-02-07 16:36:13 +11:00 committed by GStreamer Marge Bot
parent c7d5b774d5
commit a7b9857647

View file

@ -1573,9 +1573,19 @@ priv_gst_get_relocated_libgstreamer (void)
{
Dl_info info;
GST_DEBUG ("attempting to retrieve libgstreamer-1.0 location using "
"dladdr()");
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);
} else {
GST_LOG ("dladdr() failed");
return NULL;
}
}