diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2013-03-22 02:08:52 -0700 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2013-04-22 16:01:44 +0200 |
commit | 99427fbae7a810968c2058d068b1bef138bc3277 (patch) | |
tree | 1116eaeaca2de573a54bd547fc81127d1c2dbd6f | |
parent | 1bd0d597034093bc7937900b1fe882c2f1401168 (diff) |
D-Bus server: fix memory leak in case of failed restart
Found via Klocwork. Hardly relevant in practice.
-rw-r--r-- | src/dbus/server/restart.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dbus/server/restart.h b/src/dbus/server/restart.h index d9c64e1c..00a86333 100644 --- a/src/dbus/server/restart.h +++ b/src/dbus/server/restart.h @@ -25,6 +25,8 @@ #include <errno.h> +#include <boost/scoped_array.hpp> + #include <syncevo/LogRedirect.h> #include <syncevo/declarations.h> @@ -67,10 +69,10 @@ public: void restart() { - const char **argv = createArray(m_argv); - const char **env = createArray(m_env); + boost::scoped_array<const char *> argv(createArray(m_argv)); + boost::scoped_array<const char *> env(createArray(m_env)); LogRedirect::reset(); - if (execve(argv[0], (char *const *)argv, (char *const *)env)) { + if (execve(argv[0], (char *const *)argv.get(), (char *const *)env.get())) { SE_THROW(StringPrintf("restarting syncevo-dbus-server failed: %s", strerror(errno))); } } |