[ros-dev] [ros-diffs] [reactos] 01/01: [POWERCFG] Fix an exception that occurs when the control panel is closed.
Thomas Faber
thomas.faber at reactos.org
Sat May 4 05:43:16 UTC 2019
This fix seems odd. I thought HeapFree(NULL) was well-defined and did
nothing (despite what MSDN says). Pretty sure Wine uses it everywhere.
Am I missing something?
On 2019-04-27 19:02, Eric Kohl wrote:
> https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce218f70ec8a758ec6d4039690bae29c23289b9d
>
> commit ce218f70ec8a758ec6d4039690bae29c23289b9d
> Author: Eric Kohl <eric.kohl at reactos.org>
> AuthorDate: Sat Apr 27 19:00:33 2019 +0200
> Commit: Eric Kohl <eric.kohl at reactos.org>
> CommitDate: Sat Apr 27 19:01:35 2019 +0200
>
> [POWERCFG] Fix an exception that occurs when the control panel is closed.
> ---
> dll/cpl/powercfg/powershemes.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c
> index 4fff28a279..7d1441a043 100644
> --- a/dll/cpl/powercfg/powershemes.c
> +++ b/dll/cpl/powercfg/powershemes.c
> @@ -78,8 +78,12 @@ AddPowerScheme(
> dwDescription + sizeof(TCHAR));
> if (pScheme->pszName == NULL || pScheme->pszDescription == NULL)
> {
> - HeapFree(GetProcessHeap(), 0, pScheme->pszName);
> - HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
> + if (pScheme->pszName)
> + HeapFree(GetProcessHeap(), 0, pScheme->pszName);
> +
> + if (pScheme->pszDescription)
> + HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
> +
> HeapFree(GetProcessHeap(), 0, pScheme);
> return NULL;
> }
> @@ -103,8 +107,12 @@ DeletePowerScheme(
> {
> RemoveEntryList(&pScheme->ListEntry);
>
> - HeapFree(GetProcessHeap(), 0, pScheme->pszName);
> - HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
> + if (pScheme->pszName)
> + HeapFree(GetProcessHeap(), 0, pScheme->pszName);
> +
> + if (pScheme->pszDescription)
> + HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
> +
> HeapFree(GetProcessHeap(), 0, pScheme);
> }
>
>
More information about the Ros-dev
mailing list