gst-inspect: Check for empty env variables

Fixes segfault happening when gst-inspect-1.0 is invoked with empty PAGER or
GST_LESS environment variables
This commit is contained in:
Philippe Normand 2021-11-30 12:04:15 +00:00
parent a445ff1607
commit 6c471ebd5c

View file

@ -1957,13 +1957,16 @@ redirect_stdout (void)
gchar **envp;
pager = g_getenv ("PAGER");
if (pager && !*pager)
return FALSE;
if (pager == NULL)
pager = DEFAULT_PAGER;
argv = g_strsplit (pager, " ", 0);
less = g_getenv ("GST_LESS");
if (less == NULL)
if (less == NULL || !*less)
less = DEFAULT_LESS_OPTS;
envp = g_get_environ ();