crypt32: Avoid double free in CRYPT_LoadSIP on error path (coverity))

Frédéric Delanoy frederic.delanoy at gmail.com
Mon Oct 29 15:12:36 CDT 2012


On Mon, Oct 29, 2012 at 10:37 AM, Nikolay Sivov <bunglehead at gmail.com> wrote:
> On 10/29/2012 11:33, Frédéric Delanoy wrote:
>>
>> FreeLibrary(temp) can be called twice on error.
>>
>> CID 714004
>> ---
>
>>     error:
>>       FreeLibrary(lib);
>> -    FreeLibrary(temp);
>> +    if (temp != NULL) FreeLibrary(temp);
>>       SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN);
>>       return FALSE;
>>   }
>
> This is useless, FreeLibrary() checks for NULL.

Right, although it uses "SetLastError( ERROR_INVALID_HANDLE)" when it
encounters NULLs
But the return value of FreeLibrary isn't checked, so it probably
doesn't matter much.

Frédéric



More information about the wine-devel mailing list