Re: msi: Uninitialized variable fix (Coverity)
On Tue, Sep 9, 2008 at 3:54 PM, Andrew Talbot [EMAIL PROTECTED] wrote: Fix for Coverity error CID: 762. --- Changelog: msi: Uninitialized variable fix (Coverity). diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 8a8efe7..48557f0 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -3838,7 +3838,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) MSIFEATURE *feature; UINT rc; HKEY hkey; -HKEY userdata; +HKEY userdata = NULL; if (!msi_check_publish(package)) return ERROR_SUCCESS; @@ -3952,7 +3952,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) end: RegCloseKey(hkey); -RegCloseKey(userdata); +if (userdata) RegCloseKey(userdata); return rc; Please don't add another NULL-before-free check. -- James Hawkins
Re: msi: Uninitialized variable fix (Coverity)
James Hawkins wrote: On Tue, Sep 9, 2008 at 3:54 PM, Andrew Talbot [EMAIL PROTECTED] wrote: Fix for Coverity error CID: 762. [...] -RegCloseKey(userdata); +if (userdata) RegCloseKey(userdata); return rc; Please don't add another NULL-before-free check. Hi James, Sorry, I don't understand what I have done wrong. RegCloseKey() will return ERROR_INVALID_HANDLE if called with hkey==NULL. -- Andy.
Re: msi: Uninitialized variable fix (Coverity)
On Tue, Sep 9, 2008 at 4:24 PM, Andrew Talbot [EMAIL PROTECTED] wrote: James Hawkins wrote: On Tue, Sep 9, 2008 at 3:54 PM, Andrew Talbot [EMAIL PROTECTED] wrote: Fix for Coverity error CID: 762. [...] -RegCloseKey(userdata); +if (userdata) RegCloseKey(userdata); return rc; Please don't add another NULL-before-free check. Hi James, Sorry, I don't understand what I have done wrong. RegCloseKey() will return ERROR_INVALID_HANDLE if called with hkey==NULL. ...and we don't care what value it returns. -- James Hawkins
Re: msi: Uninitialized variable fix (Coverity)
Hi Andy, Sorry, I don't understand what I have done wrong. RegCloseKey() will return ERROR_INVALID_HANDLE if called with hkey==NULL. To expand on James's brief response, -HKEY userdata; +HKEY userdata = NULL; This change looks correct, but the other isn't necessary. --Juan
Re: msi: Uninitialized variable fix (Coverity)
James Hawkins wrote: Sorry, I don't understand what I have done wrong. RegCloseKey() will return ERROR_INVALID_HANDLE if called with hkey==NULL. ...and we don't care what value it returns. Ah, of course! Thanks, James (and Juan). -- Andy.