diff --git a/reactos/base/system/services/config.c b/reactos/base/system/services/config.c index 9a95f56eceb..922a3967952 100644 --- a/reactos/base/system/services/config.c +++ b/reactos/base/system/services/config.c @@ -288,7 +288,8 @@ done:; if (dwError != ERROR_SUCCESS) { HeapFree(GetProcessHeap(), 0, ptr); - HeapFree(GetProcessHeap(), 0, expanded); + if (expanded) + HeapFree(GetProcessHeap(), 0, expanded); } return dwError;