- Remove dead code
- Fix check for memory deallocation
- Don't leak resource

CID #500056
CID #500057
CID #501497
CID #716313

svn path=/trunk/; revision=62645
This commit is contained in:
Pierre Schweitzer 2014-04-06 12:18:05 +00:00
parent ab56f03e58
commit 35ab776df7
2 changed files with 4 additions and 5 deletions

View file

@ -135,15 +135,18 @@ EnumServices(ENUM_SERVICE_STATUS_PROCESS **pServiceStatus,
&ResumeHandle,
0))
{
CloseServiceHandle(hSCManager);
return NumServices;
}
}
}
ReportLastError();
if (pServiceStatus)
if (*pServiceStatus)
HeapFree(GetProcessHeap(), 0, *pServiceStatus);
CloseServiceHandle(hSCManager);
return NumServices;
}
@ -237,8 +240,5 @@ Query(LPCTSTR *ServiceArgs,
}
}
if (pServiceStatus)
HeapFree(GetProcessHeap(), 0, pServiceStatus);
return TRUE;
}

View file

@ -74,7 +74,6 @@ BOOL Start(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, INT ArgCount)
fail:
ReportLastError();
if (pServiceInfo) HeapFree(GetProcessHeap(), 0, pServiceInfo);
if (hSc) CloseServiceHandle(hSc);
if (hSCManager) CloseServiceHandle(hSCManager);
return FALSE;