summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-16 03:20:11 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-05-16 03:25:50 +0200
commit8675d66abd6e40baa40fcfcf3a722119eb18527b (patch)
tree0284f9dc455061556f85c4737bd207b28d44e796 /src/irmd/main.c
parent22ef5ea7feeace47bff9d16434a4b705d1ae4a82 (diff)
downloadouroboros-8675d66abd6e40baa40fcfcf3a722119eb18527b.tar.gz
ouroboros-8675d66abd6e40baa40fcfcf3a722119eb18527b.zip
irmd: fixed unlock after free
unlock is now called before the object is destroyed.
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index b7e1ad18..6030f0b1 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1223,7 +1223,7 @@ static void irm_destroy(struct irm * irm)
if (irm == NULL)
return;
- rw_lock_wrlock(&instance->state_lock);
+ rw_lock_wrlock(&irm->state_lock);
if (irm->threadpool != NULL)
free(irm->threadpool);
@@ -1256,9 +1256,11 @@ static void irm_destroy(struct irm * irm)
shm_du_map_destroy(irm->dum);
close(irm->sockfd);
+
+ rw_lock_unlock(&irm->state_lock);
+
free(irm);
- rw_lock_unlock(&instance->state_lock);
}
void irmd_sig_handler(int sig, siginfo_t * info, void * c)