[Mesa-dev] [PATCH 2/5] glx: Move DRI extensions pointer loading to driOpenDriver().

Eric Anholt eric at anholt.net
Fri Nov 16 21:45:03 UTC 2018


Emil Velikov <emil.l.velikov at gmail.com> writes:

> On Thu, 15 Nov 2018 at 23:05, Eric Anholt <eric at anholt.net> wrote:
>
>> --- a/src/glx/dri_glx.c
>> +++ b/src/glx/dri_glx.c
>> @@ -199,15 +199,9 @@ clear_driver_config_cache()
>>  static char *
>>  get_driver_config(const char *driverName)
>>  {
>> -   void *handle = driOpenDriver(driverName);
>> -   const __DRIextension **extensions;
>> -
>> -   if (!handle)
>> -      return NULL;
>> -
>> +   void *handle;
> I think we want to initialise this variable.
>
> Otherwise on failure when driGetDriverExtensions() fails, we'll feed
> garbage into dlclose() further down.
> It's unlikely that will happen, but If nothing else the static
> analysis tools will be happy.

After driGetDriverExtensions() failure driOpenDriver() NULLs out the
handle that gets stored to *out_driver_handle.  I did that so that all
the callers didn't have to worry about this.  (aka asprintf is the worst
interface)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181116/5227eb1d/attachment-0001.sig>


More information about the mesa-dev mailing list