2013-04-12 Hirofumi Kosaka <kosaka@rworks.jp>

* modules/pandora_module_exec.cc: Fixed possible resource leaks,
	only when CreateProcess() or CreatePipe() would fail.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7968 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2013-04-12 07:16:51 +00:00
parent a8d5111057
commit 2dc9e5d79a
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2013-04-12 Hirofumi Kosaka <kosaka@rworks.jp>
* modules/pandora_module_exec.cc: Fixed possible resource leaks,
only when CreateProcess() or CreatePipe() would fail.
Merged from branch 4.x
2013-04-11 Ramon Novoa <rnovoa@artica.es>
* pandora_windows_service.cc,

View File

@ -80,6 +80,8 @@ Pandora_Module_Exec::run () {
if (! CreatePipe (&out_read, &new_stdout, &attributes, 0)) {
pandoraLog ("CreatePipe failed. Err: %d", GetLastError ());
this->has_output = false;
CloseHandle (job);
return;
}
@ -111,6 +113,9 @@ Pandora_Module_Exec::run () {
pandoraLog ("Pandora_Module_Exec: %s CreateProcess failed. Err: %d",
this->module_name.c_str (), GetLastError ());
this->has_output = false;
/* Close job */
CloseHandle (job);
} else {
char buffer[BUFSIZE + 1];
unsigned long read, avail;
@ -135,7 +140,7 @@ Pandora_Module_Exec::run () {
break;
} else if(this->getTimeout() < GetTickCount() - tickbase) {
/* STILL_ACTIVE */
TerminateProcess(pi.hThread, STILL_ACTIVE);
TerminateProcess(pi.hProcess, STILL_ACTIVE);
pandoraLog ("Pandora_Module_Exec: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
break;
}