Skip to content

Commit 24ab57c

Browse files
authored
Update SCShell.c
1 parent 937a80c commit 24ab57c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

SCShell.c

+6
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ int main(int argc, char **argv) {
6161
printf("Opening %s\n", serviceName);
6262
SC_HANDLE schService = OpenServiceA(schManager, serviceName, SERVICE_ALL_ACCESS);
6363
if(schService == NULL) {
64+
CloseServiceHandle(schManager);
6465
printf("OpenServiceA failed %ld\n", GetLastError());
6566
ExitProcess(0);
6667
}
@@ -105,5 +106,10 @@ int main(int argc, char **argv) {
105106
}
106107
printf("Service path was restored to \"%s\"\n", originalBinaryPath);
107108
}
109+
110+
GlobalFree(lpqsc);
111+
CloseHandle(hToken);
112+
CloseServiceHandle(schManager);
113+
CloseServiceHandle(schService);
108114
return 0;
109115
}

0 commit comments

Comments
 (0)