driconf: initialize the option value before using it

ParseValue is freeing the pointer if the address is != 0. However,
since we allocate this value on the stack, we need to initialize the
data first.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7212>
This commit is contained in:
Martin Peres 2020-10-15 18:27:27 +03:00
parent 0e3a424f00
commit f9763b2054

View file

@ -377,6 +377,10 @@ driParseOptionInfo(driOptionCache *info,
char *envVal = getenv(name);
if (envVal != NULL) {
driOptionValue v;
/* make sure the value is initialized to something sensible */
v._string = NULL;
if (parseValue(&v, opt->info.type, envVal) &&
checkValue(&v, optinfo)) {
/* don't use XML_WARNING, we want the user to see this! */