From a7b9857647841c0d850a4443cc6e832e13c30dd1 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 7 Feb 2022 16:36:13 +1100 Subject: [PATCH] registry: check the value of dladdr() info.dli_fname could be NULL. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/994 Part-of: --- subprojects/gstreamer/gst/gstregistry.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subprojects/gstreamer/gst/gstregistry.c b/subprojects/gstreamer/gst/gstregistry.c index 21ccb74..3b1906e 100644 --- a/subprojects/gstreamer/gst/gstregistry.c +++ b/subprojects/gstreamer/gst/gstregistry.c @@ -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; } } -- 2.7.4