loader: don't return empty string in loader_get_dri_config_device_id

The caller expects a NULL return value if the option isn't set.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17298>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2022-06-29 10:03:16 +02:00
committed by Marge Bot
parent 6daf99fcb2
commit 6d50e4cdc1
+5 -2
View File
@@ -240,8 +240,11 @@ static char *loader_get_dri_config_device_id(void)
ARRAY_SIZE(__driConfigOptionsLoader));
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
"loader", NULL, NULL, NULL, 0, NULL, 0);
if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
if (driCheckOption(&userInitOptions, "device_id", DRI_STRING)) {
char *opt = driQueryOptionstr(&userInitOptions, "device_id");
if (*opt)
prime = strdup(opt);
}
driDestroyOptionCache(&userInitOptions);
driDestroyOptionInfo(&defaultInitOptions);