diff options
author | Martin Willi <martin@revosec.ch> | 2013-03-26 16:19:00 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2013-05-06 15:28:26 +0200 |
commit | 5e9144a21ff15e38f1a6b89fad4b6b02f443051a (patch) | |
tree | 2310021c6e643d01e3d98d351a1bc70e5bffce6e | |
parent | 2baa7bbedb7d1ffd149fc326dfe28ed81dbcd09f (diff) | |
download | strongswan-5e9144a21ff15e38f1a6b89fad4b6b02f443051a.tar.bz2 strongswan-5e9144a21ff15e38f1a6b89fad4b6b02f443051a.tar.xz |
controller: clean up job data if a thread gets cancelled waiting in a function
Controller functions are thread cancellation points, so register a cancellation
handler cleaning up job data.
-rw-r--r-- | src/libcharon/control/controller.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcharon/control/controller.c b/src/libcharon/control/controller.c index 0ee99c4b7..c546da544 100644 --- a/src/libcharon/control/controller.c +++ b/src/libcharon/control/controller.c @@ -412,6 +412,7 @@ METHOD(controller_t, initiate, status_t, .refcount = 1, ); job->listener.logger.listener = &job->listener; + thread_cleanup_push((void*)destroy_job, job); if (callback == NULL) { @@ -425,7 +426,7 @@ METHOD(controller_t, initiate, status_t, } } status = job->listener.status; - destroy_job(job); + thread_cleanup_pop(TRUE); return status; } @@ -500,6 +501,7 @@ METHOD(controller_t, terminate_ike, status_t, .refcount = 1, ); job->listener.logger.listener = &job->listener; + thread_cleanup_push((void*)destroy_job, job); if (callback == NULL) { @@ -513,7 +515,7 @@ METHOD(controller_t, terminate_ike, status_t, } } status = job->listener.status; - destroy_job(job); + thread_cleanup_pop(TRUE); return status; } @@ -615,6 +617,7 @@ METHOD(controller_t, terminate_child, status_t, .refcount = 1, ); job->listener.logger.listener = &job->listener; + thread_cleanup_push((void*)destroy_job, job); if (callback == NULL) { @@ -628,7 +631,7 @@ METHOD(controller_t, terminate_child, status_t, } } status = job->listener.status; - destroy_job(job); + thread_cleanup_pop(TRUE); return status; } |