diff options
-rw-r--r-- | src/anytun.cpp | 2 | ||||
-rw-r--r-- | src/bsd/tunDevice.cpp | 2 | ||||
-rw-r--r-- | src/linux/tunDevice.cpp | 2 | ||||
-rw-r--r-- | src/sysExec.cpp | 10 | ||||
-rw-r--r-- | src/sysExec.h | 2 |
5 files changed, 9 insertions, 9 deletions
diff --git a/src/anytun.cpp b/src/anytun.cpp index 50aa255..0268ff1 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -432,7 +432,7 @@ int main(int argc, char* argv[]) #ifndef NO_EXEC boost::thread(boost::bind(&TunDevice::waitUntilReady,&dev)); if (postup_script) - boost::thread(boost::bind(&SysExec::waitAndDestroy,&postup_script)); + boost::thread(boost::bind(&SysExec::waitAndDestroy,postup_script)); #endif initCrypto(); diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp index 84fa727..1413b5f 100644 --- a/src/bsd/tunDevice.cpp +++ b/src/bsd/tunDevice.cpp @@ -278,6 +278,6 @@ void TunDevice::do_ifconfig() void TunDevice::waitUntilReady() { if(sys_exec_) - SysExec::waitAndDestroy(&sys_exec_); + SysExec::waitAndDestroy(sys_exec_); } diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp index bb3e722..f4d6a72 100644 --- a/src/linux/tunDevice.cpp +++ b/src/linux/tunDevice.cpp @@ -169,5 +169,5 @@ void TunDevice::do_ifconfig() void TunDevice::waitUntilReady() { if(sys_exec_) - SysExec::waitAndDestroy(&sys_exec_); + SysExec::waitAndDestroy(sys_exec_); } diff --git a/src/sysExec.cpp b/src/sysExec.cpp index b6f47d8..005e2cc 100644 --- a/src/sysExec.cpp +++ b/src/sysExec.cpp @@ -176,12 +176,12 @@ int SysExec::getReturnCode() const return return_code_; } -void SysExec::waitAndDestroy(SysExec** s) +void SysExec::waitAndDestroy(SysExec*& s) { - if(!s && !(*s)) + if(!s) return; - (*s)->waitForScript(); - delete(*s); - *s = NULL; + s->waitForScript(); + delete(s); + s = NULL; } diff --git a/src/sysExec.h b/src/sysExec.h index 7aada56..268384a 100644 --- a/src/sysExec.h +++ b/src/sysExec.h @@ -54,7 +54,7 @@ class SysExec int waitForScript(); int getReturnCode() const; - static void waitAndDestroy(SysExec** s); + static void waitAndDestroy(SysExec*& s); private: void doExec(std::string const& script, StringVector const& args, StringList const& env); |