aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-02-13 09:44:34 +0100
committerMartin Willi <martin@revosec.ch>2014-05-07 14:13:36 +0200
commit9bfa397ebaca5ce2ce1414a6e60a36838b181d35 (patch)
tree92c191ddcafcb1a8cad5c17ab2c7e0d457fd6b8a /src/libcharon/plugins
parente2496bda024e283cf8d5131b6571de7818b5cd90 (diff)
downloadstrongswan-9bfa397ebaca5ce2ce1414a6e60a36838b181d35.tar.bz2
strongswan-9bfa397ebaca5ce2ce1414a6e60a36838b181d35.tar.xz
vici: Fix dispatcher leak when handling unknown request
Diffstat (limited to 'src/libcharon/plugins')
-rw-r--r--src/libcharon/plugins/vici/vici_dispatcher.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libcharon/plugins/vici/vici_dispatcher.c b/src/libcharon/plugins/vici/vici_dispatcher.c
index b66d0d5e8..3bb5eda26 100644
--- a/src/libcharon/plugins/vici/vici_dispatcher.c
+++ b/src/libcharon/plugins/vici/vici_dispatcher.c
@@ -220,26 +220,27 @@ void process_request(private_vici_dispatcher_t *this, char *name, u_int id,
{
vici_message_t *response = NULL;
release_data_t *release;
-
- INIT(release,
- .this = this,
- );
+ command_t *cmd;
this->mutex->lock(this->mutex);
- release->cmd = this->cmds->get(this->cmds, name);
- if (release->cmd)
+ cmd = this->cmds->get(this->cmds, name);
+ if (cmd)
{
- release->cmd->uses++;
+ cmd->uses++;
}
this->mutex->unlock(this->mutex);
- if (release->cmd)
+ if (cmd)
{
+ INIT(release,
+ .this = this,
+ .cmd = cmd,
+ );
+
thread_cleanup_push(release_command, release);
release->request = vici_message_create_from_data(data, FALSE);
- response = release->cmd->cb(release->cmd->user, release->cmd->name,
- id, release->request);
+ response = release->cmd->cb(cmd->user, cmd->name, id, release->request);
thread_cleanup_pop(TRUE);